Bug 385801

Summary: favor function taking or returning std::chrono types
Product: [Developer tools] clazy Reporter: eric.lemanissier
Component: generalAssignee: Unassigned bugs <unassigned-bugs-null>
Status: CONFIRMED ---    
Severity: wishlist CC: eric.lemanissier, smartins
Priority: NOR    
Version First Reported In: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description eric.lemanissier 2017-10-16 08:21:44 UTC
Some members function of Qt classes have one overload taking time as plain integer, and another taking time as std::chrono::duration or std::chrono::time_point. Plain integers are error prone, because the unit is implicit, so one must refer to the doc to make sure there is no error. Clazy could warn the usage of the plain integer overloads, and propose a fixit. 
in QTimer: setInterval, singleShot, start
in QDeadlineTimer: Constructor, operator=, setDeadline, setRemainingTime, operator+, operator+=
in QMutex: tryLock can be replaced with try_lock_for or try_lock_until
QObject::startTimer

The other case which could be ambiguous is function returning integer, which can be replaced with another returning a std::chrono::duration
in QTimer, interval can be replaced with intervalAsDuration. remainingTime can be replaced with remainingTimeAsDuration
in QDeadLineTimer deadline can be replaced with templated deadline. remainingTime and remainingTimeNSecs can be replaced with remainingTimeAsDuration