Details
-
Bug
-
Resolution: Done
-
Not Evaluated
-
4.7.4
-
None
-
Tested on Windows, maybe other platforms have the correct behaviour
-
6da3e4d865e391a1d291c4729f4771a87c6bcd65
Description
According to the documentation QElapsedTimer::msecsTo(QElapsedTimer other) returns a positive value if other was started before this. However, the actual implementation is exactly the other way round, it returns a positive value when this was started before other.
Simple program to validate:
#include <QElapsedTimer> #include <QThread> #include <QDebug> class Thread: public QThread { public: using QThread::sleep; }; int main(int argc, char *argv[]) { QElapsedTimer timer1; timer1.start(); Thread::sleep(1); QElapsedTimer timer2; timer2.start(); qDebug() << timer2.msecsTo(timer1); qDebug() << timer1.msecsTo(timer2); return 0; }
Results in:
-998 998