From 63e010a09d53e0269182902a17dd2e79738f2e23 Mon Sep 17 00:00:00 2001 From: Rohan McGovern Date: Thu, 29 Jul 2010 09:16:30 +1000 Subject: Fixed instability of tst_qdatetime::currentDateTime(Utc) on Linux It's possible for the second to tick over in gettimeofday() earlier than time() (verified with strace). So this test needs an extra second of leeway. --- tests/auto/qdatetime/tst_qdatetime.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/auto/qdatetime/tst_qdatetime.cpp b/tests/auto/qdatetime/tst_qdatetime.cpp index 1a82a4c..1841487 100644 --- a/tests/auto/qdatetime/tst_qdatetime.cpp +++ b/tests/auto/qdatetime/tst_qdatetime.cpp @@ -959,7 +959,9 @@ void tst_QDateTime::currentDateTime() #endif QDateTime upperBound; upperBound.setTime_t(buf2); - upperBound = upperBound.addSecs(1); + // Note we must add 2 seconds here because time() may return up to + // 1 second difference from the more accurate method used by QDateTime::currentDateTime() + upperBound = upperBound.addSecs(2); QString details = QString("\n" "lowerBound: %1\n" @@ -1010,7 +1012,9 @@ void tst_QDateTime::currentDateTimeUtc() #endif QDateTime upperBound; upperBound.setTime_t(buf2); - upperBound = upperBound.addSecs(1); + // Note we must add 2 seconds here because time() may return up to + // 1 second difference from the more accurate method used by QDateTime::currentDateTime() + upperBound = upperBound.addSecs(2); QString details = QString("\n" "lowerBound: %1\n" -- cgit v0.12