diff options
author | Edward Welbourne <edward.welbourne@qt.io> | 2021-01-29 14:35:23 +0100 |
---|---|---|
committer | Edward Welbourne <edward.welbourne@qt.io> | 2021-02-01 16:28:26 +0100 |
commit | 38a72af4fd311219779f89b2b78cd56d879f61db (patch) | |
tree | e00c3d625134ac81459fa92b5f94d2c98095c1fd /src | |
parent | 38d1444a606679228b2a3c1d743f00225f6c25a1 (diff) |
Fix handling of Sunday in POSIX time-zone rules
Dating from the origins of our support for the zoneinfo file format,
the mapping of POSIX's day-numbering (0 = Sunday through 6 = Saturday,
see [*]) to Qt's (1 = Monday through 7 = Sunday) was done by mapping 0
to 1, when it should have been 7.
[*] http://www.gnu.org/software/libc/manual/html_node/TZ-Variable.html
Corrected a QTimeZone test that trusted the results it got without
checking which day of the week those were: they were all Mondays.
Verified that the corrected dates are in fact Sundays.
Checked the zone abbreviations, too.
Fixes: QTBUG-90553
Pick-to: 6.0 5.15
Change-Id: I84b4b14f9892ff687918cd3c42c7c9807e45313c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/time/qtimezoneprivate_tz.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/corelib/time/qtimezoneprivate_tz.cpp b/src/corelib/time/qtimezoneprivate_tz.cpp index 126e64add5..ace966e15b 100644 --- a/src/corelib/time/qtimezoneprivate_tz.cpp +++ b/src/corelib/time/qtimezoneprivate_tz.cpp @@ -372,8 +372,8 @@ static QDate calculatePosixDate(const QByteArray &dateRule, int year) int month = dateParts.at(0).mid(1).toInt(); int week = dateParts.at(1).toInt(); int dow = dateParts.at(2).toInt(); - if (dow == 0) - ++dow; + if (dow == 0) // Sunday; we represent it as 7 + dow = 7; return calculateDowDate(year, month, dow, week); } else if (dateRule.at(0) == 'J') { // Day of Year ignores Feb 29 |