summaryrefslogtreecommitdiffstats
path: root/tests/auto/qelapsedtimer
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/qelapsedtimer')
-rw-r--r--tests/auto/qelapsedtimer/tst_qelapsedtimer.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/tests/auto/qelapsedtimer/tst_qelapsedtimer.cpp b/tests/auto/qelapsedtimer/tst_qelapsedtimer.cpp
index 87df57d..bc61f52 100644
--- a/tests/auto/qelapsedtimer/tst_qelapsedtimer.cpp
+++ b/tests/auto/qelapsedtimer/tst_qelapsedtimer.cpp
@@ -122,11 +122,13 @@ void tst_QElapsedTimer::basics()
quint64 value1 = t1.msecsSinceReference();
qDebug() << value1 << t1;
+ qint64 nsecs = t1.nsecsElapsed();
qint64 elapsed = t1.restart();
QVERIFY(elapsed < minResolution);
+ QVERIFY(nsecs / 1000000 < minResolution);
quint64 value2 = t1.msecsSinceReference();
- qDebug() << value2 << t1 << elapsed;
+ qDebug() << value2 << t1 << elapsed << nsecs;
// in theory, elapsed == value2 - value1
// However, since QElapsedTimer keeps internally the full resolution,
@@ -150,7 +152,10 @@ void tst_QElapsedTimer::elapsed()
// don't check: t1.secsTo(t2)
// QVERIFY(t1 - t2 < 0);
+ QVERIFY(t1.nsecsElapsed() > 0);
QVERIFY(t1.elapsed() > 0);
+ // the number of elapsed nanoseconds and milliseconds should match
+ QVERIFY(t1.nsecsElapsed() - t1.elapsed() * 1000000 < 1000000);
QVERIFY(t1.hasExpired(minResolution));
QVERIFY(!t1.hasExpired(8*minResolution));
QVERIFY(!t2.hasExpired(minResolution));