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);