From 82ad4be4a2e0c2bccb6cd8ea2440aefee4ec48ec Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Wed, 27 Mar 2019 17:01:40 +0000 Subject: Fix various uncommon cases in QTzTimeZonePrivate backend MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Includes a fixup for 03fadc26e7617aece89949bc7d0acf50f6f050a9, which removed the check on empty transition list, needed when no data are available. Ensured that such a data-free zone would in fact be noticed as invalid during init(). Fixed handling of times before the epoch (we still want to consult a POSIX rule, if that's all that's available) while ensuring we (as documented) ignore DST for such times. Fixed handling of large times (milliseconds since epoch outside int range) when looking up POSIX rules. Gave QTimeZonePrivate a YearRange enum (to be moved to QTimeZone once this merges up to dev) so as to eliminate a magic number (and avoid adding another). Moved year-munging in POSIX rules after the one early return, which doesn't need the year range. Added test-cases for the distant past/future (just checking UTC's offsets; SLES has a minimal version of the UTC data-file that triggers the bugs fixed here for them). Fixes: QTBUG-74666 Fixes: QTBUG-74550 Change-Id: Ief7b7e55c62cf11064700934f404b2fc283614e1 Reviewed-by: Tony Sarajärvi Reviewed-by: Thiago Macieira --- tests/auto/corelib/tools/qtimezone/tst_qtimezone.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/auto/corelib/tools/qtimezone/tst_qtimezone.cpp b/tests/auto/corelib/tools/qtimezone/tst_qtimezone.cpp index eff9835776..bb6c48a2ed 100644 --- a/tests/auto/corelib/tools/qtimezone/tst_qtimezone.cpp +++ b/tests/auto/corelib/tools/qtimezone/tst_qtimezone.cpp @@ -539,8 +539,13 @@ void tst_QTimeZone::checkOffset_data() int year, month, day, hour, min, sec; int std, dst; } table[] = { - // Zone with no transitions (QTBUG-74614, when TZ backend uses minimalist data) + // Zone with no transitions (QTBUG-74614, QTBUG-74666, when TZ backend uses minimal data) { "Etc/UTC", "epoch", 1970, 1, 1, 0, 0, 0, 0, 0 }, + { "Etc/UTC", "pre_int32", 1901, 12, 13, 20, 45, 51, 0, 0 }, + { "Etc/UTC", "post_int32", 2038, 1, 19, 3, 14, 9, 0, 0 }, + { "Etc/UTC", "post_uint32", 2106, 2, 7, 6, 28, 17, 0, 0 }, + { "Etc/UTC", "initial", -292275056, 5, 16, 16, 47, 5, 0, 0 }, + { "Etc/UTC", "final", 292278994, 8, 17, 7, 12, 55, 0, 0 }, // Kiev: regression test for QTBUG-64122 (on MS): { "Europe/Kiev", "summer", 2017, 10, 27, 12, 0, 0, 2 * 3600, 3600 }, { "Europe/Kiev", "winter", 2017, 10, 29, 12, 0, 0, 2 * 3600, 0 } -- cgit v1.2.3