Details
-
Bug
-
Resolution: Fixed
-
P3: Somewhat important
-
5.15.2
-
None
-
Qt 5.15.2, Windows 10, Qt Creator 4.14.0
-
-
qtbase/35412acd88cad2213be966a950f3112342a299ae qtbase/b4a875544ba8f2d11e183d67f45891d6149203ed
Description
Local time zone is Central European Time (CET) / Central European Summer Time (CEST)
Example:
QDateTime dt;
dt.setTimeSpec(Qt::LocalTime);
QDateTime dtUtc;
dtUtc.setTimeSpec(Qt::UTC);
qint64 secsSince1970 = 2153407610; // 28th of March 2038 16:56:50 UTC
dt.setSecsSinceEpoch(secsSince1970);
dtUtc.setSecsSinceEpoch(secsSince1970);
Result:
dtUtc is set to 28th of March 2038 16:56:50 UTC correctly
dt is set to 28th of March 2038 17:56:50 Local time but should be 1 hour later
Affected time ranges:
Sun 28 Mar 2038 01:00:00 UTC - Mon 29 Mar 2038 00:59:59 UTC - Qt at CET, actually CEST
Mon 25 Oct 2038 01:00:00 UTC - Sun 31 Oct 2038 00:59:59 UTC - Qt at CET, actually CEST
Sun 27 Mar 2039 01:00:00 UTC - Tue 29 Mar 2039 00:59:59 UTC - Qt at CET, actually CEST
Tue 25 Oct 2039 01:00:00 UTC - Sun 30 Oct 2039 00:59:59 UTC - Qt at CET, actually CEST
Sun 25 Mar 2040 01:00:00 UTC - Thu 29 Mar 2040 00:59:59 UTC - Qt at CET, actually CEST
Thu 25 Oct 2040 01:00:00 UTC - Sun 28 Oct 2040 00:59:59 UTC - Qt at CET, actually CEST
Fri 29 Mar 2041 01:00:00 UTC - Sun 31 Mar 2041 00:59:59 UTC - Qt at CEST, actually CET
Fri 25 Oct 2041 01:00:00 UTC - Sun 27 Oct 2041 00:59:59 UTC - Qt at CET, actually CEST
Sat 29 Mar 2042 01:00:00 UTC - Sun 30 Mar 2042 00:59:59 UTC - Qt at CEST, actually CET
Sat 25 Oct 2042 01:00:00 UTC - Sun 26 Oct 2042 00:59:59 UTC - Qt at CET, actually CEST
2043 no issue (Switchover Sun 25 Mar and Sun 25 Oct for both Qt and actually)
Sun 27 Mar 2044 01:00:00 UTC - Tue 29 Mar 2044 00:59:59 UTC - Qt at CET, actually CEST
Tue 25 Oct 2044 01:00:00 UTC - Sun 30 Oct 2044 00:59:59 UTC - Qt at CET, actually CEST
And so on. It seems that after 2038 Qt always switches daylight saving time on the 29th of March and 25th of October, whereas it should be on the last Sundays of March and October.
My suspicion is that for calculation of daylight saving time a conversion to 32 bit unix time causes an overflow somewhere.