From 6272f01617e596b788ff751082504e6e0d0c7fda Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 10 Mar 2015 17:32:15 -0700 Subject: [PATCH] tst_QDateTime: remove silly test for timezone date too early Let's not try to to compare our QTimeZone handling with the system one. Our handling goes beyond the range of the POSIX APIs, so that's a recipe for error. Change-Id: Iee8cbc07c4434ce9b560ffff13ca4a4f335bdbae Reviewed-by: Lars Knoll Reviewed-by: Friedemann Kleint --- tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp b/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp index 24453d35b6..4ab79909e3 100644 --- a/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp +++ b/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp @@ -611,13 +611,11 @@ void tst_QDateTime::setMSecsSinceEpoch() dt2.setTimeZone(europe); dt2.setMSecsSinceEpoch(msecs); QCOMPARE(dt2.date(), european.date()); -#ifdef Q_OS_MAC - // NSTimeZone doesn't apply DST to high values - if (msecs < (Q_INT64_C(123456) << 32)) -#else - // Linux and Win are OK except when they overflow - if (msecs != std::numeric_limits::max()) -#endif + + // don't compare the time if the date is too early or too late: prior + // to 1916, timezones in Europe were not standardised and some OS APIs + // have hard limits. Let's restrict it to the 32-bit Unix range + if (dt2.date().year() >= 1970 && dt2.date().year() <= 2037) QCOMPARE(dt2.time(), european.time()); QCOMPARE(dt2.timeSpec(), Qt::TimeZone); QCOMPARE(dt2.timeZone(), europe);