summaryrefslogtreecommitdiffstats
path: root/src/corelib/time/qtimezoneprivate_tz.cpp
diff options
context:
space:
mode:
authorEdward Welbourne <edward.welbourne@qt.io>2021-01-29 14:35:23 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-02-01 17:38:57 +0000
commit976ee881495ba176da5b0468aaf1162bbdc5c3f5 (patch)
tree47c2d3578aa2fdb0880818f7951341ee799b63a0 /src/corelib/time/qtimezoneprivate_tz.cpp
parent1e1b5c44af3a2fa4c41bd6cd91f17a1c19f4a2ed (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 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> (cherry picked from commit 38a72af4fd311219779f89b2b78cd56d879f61db) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src/corelib/time/qtimezoneprivate_tz.cpp')
-rw-r--r--src/corelib/time/qtimezoneprivate_tz.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/corelib/time/qtimezoneprivate_tz.cpp b/src/corelib/time/qtimezoneprivate_tz.cpp
index 938f8d119a..0b97d39091 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