Details
-
Bug
-
Resolution: Done
-
P1: Critical
-
5.15.10
-
None
-
-
a567d14c0f (qt/tqtc-qtbase/5.15)
Description
The behavior of QDateTime::addDays() has changed between 5.15.8 and 5.15.10 when a DST change happens in the days that are added. Using this test program:
#include <QTimeZone> #include <QDateTime> #include <QDebug> int main(int argc, char *argv[]) { QDateTime dt = QDateTime::fromSecsSinceEpoch(1143325800, Qt::LocalTime); QDateTime plusOne = dt.addDays(1); qDebug() << QT_VERSION_STR << QTimeZone::systemTimeZone(); qDebug() << dt << dt.toUTC(); qDebug() << plusOne << plusOne.toUTC(); qDebug() << dt.secsTo(plusOne) << dt.daysTo(plusOne); }
the value of plusOne is different for Qt 5.15.8 and 5.15.10 (note the time zone):
5.15.8 QTimeZone("Europe/Vienna") QDateTime(2006-03-25 23:30:00.000 W. Europe Standard Time Qt::LocalTime) QDateTime(2006-03-25 22:30:00.000 UTC Qt::UTC) QDateTime(2006-03-26 23:30:00.000 W. Europe Daylight Time Qt::LocalTime) QDateTime(2006-03-26 21:30:00.000 UTC Qt::UTC) 82800 1 15.15.10 QTimeZone("Europe/Vienna") QDateTime(2006-03-25 23:30:00.000 W. Europe Standard Time Qt::LocalTime) QDateTime(2006-03-25 22:30:00.000 UTC Qt::UTC) QDateTime(2006-03-27 00:30:00.000 W. Europe Daylight Time Qt::LocalTime) QDateTime(2006-03-26 22:30:00.000 UTC Qt::UTC) 86400 2
This is probably related to https://bugreports.qt.io/browse/QTBUG-102109
Attachments
Issue Links
- resulted from
-
QTBUG-102109 In Android using Qt::LocalTime with specific timezones does not handle daylight-saving time properly
- Closed