QIncrementalSleepTimer: Use QElapsedTimer instead of QTime

Since the former is monotonic and we need a monotonic timer here.

Change-Id: I34325da4fe0317e12f64629a6eef6a80990c3e1a
Reviewed-by: Daniel Teske <daniel.teske@theqtcompany.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Daniel Teske 2015-01-14 16:27:10 +01:00 committed by Joerg Bornemann
parent c49641a117
commit c243dd5643

View File

@ -45,7 +45,7 @@
// We mean it.
//
#include <qdatetime.h>
#include <qelapsedtimer.h>
#include <qthread.h>
#include <qmutex.h>
#include <qwaitcondition.h>
@ -83,7 +83,7 @@ public:
{
if (totalTimeOut == -1)
return SLEEPMAX;
return qMax(totalTimeOut - timer.elapsed(), 0);
return qMax(int(totalTimeOut - timer.elapsed()), 0);
}
bool hasTimedOut() const
@ -99,7 +99,7 @@ public:
}
private:
QTime timer;
QElapsedTimer timer;
int totalTimeOut;
int nextSleep;
};