Details
-
Bug
-
Resolution: Duplicate
-
P3: Somewhat important
-
None
-
5.4.1, 5.4.2
-
None
-
Qt 5.4.1, Windows 8 64bit, MinGW 32bit, MSVC2013 32bit, MSVC2013 64bit
Description
Here is sample code for a bug reproduction:
#include <QCoreApplication> #include <QDateTime> #include <QTimeZone> #include <iostream> static void printQdt(const QDateTime &qdt) { std::cout << qdt.toString("yyyy-MM-dd HH-mm-ss.zzz t").toStdString() << ", offsetFromUtc: " << qdt.offsetFromUtc() << std::endl; } int main(int argc, char *argv[]) { QCoreApplication a(argc, argv); QDateTime point(QDate(2015, 5, 27), QTime(16, 37, 00), QTimeZone("Europe/Moscow")); printQdt(point); printQdt(point.toUTC()); return a.exec(); }
In a GNU/Linux environment output is following (i.e. a datetime representation converted to UTC as expected):
2015-05-27 16-37-00.000 MSK, offsetFromUtc: 10800 2015-05-27 13-37-00.000 UTC, offsetFromUtc: 0
In a Windows 8 environment output is following (i.e. UTC conversion failed, although time zone itself looks correct):
2015-05-27 16-37-00.000 RTZ 2 (winter), offsetFromUtc: 0 2015-05-27 16-37-00.000 UTC, offsetFromUtc: 0
Once you change time to another one (for example, "Europe/Paris") then it works as expected in both cases.
Attachments
Issue Links
- duplicates
-
QTBUG-42021 Incorrect calculation of next/previous transition in time zone on Windows
-
- Closed
-
- relates to
-
QTBUG-46455 Time is incorrect for a given milliseconds since epoch under Moscow's timezone
-
- Closed
-