summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2015-03-10 17:32:15 -0700
committerFriedemann Kleint <Friedemann.Kleint@theqtcompany.com>2015-03-11 07:23:21 +0000
commit6272f01617e596b788ff751082504e6e0d0c7fda (patch)
treea4b55f7e9ef65130f9dac3a927a76deeca89c329
parentc87f8a379706e2a8099c42c2ffe09f258315bb64 (diff)
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 <lars.knoll@digia.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
-rw-r--r--tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp12
1 files 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<qint64>::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);