Details
-
Bug
-
Resolution: Out of scope
-
P3: Somewhat important
-
None
-
5.5.0
-
Windows
Description
QDateTime does not always provide the timezone information correctly when the time zone is changed by user while the application is running on Windows.
Example code which demonstrates the problem (full example code attached):
QDateTime localnow = QDateTime::currentDateTime(); localnow.setOffsetFromUtc(localnow.offsetFromUtc()); localnow.toString(Qt::ISODate); localnow.setTimeSpec(Qt::LocalTime); // CHANGE time zone while the for loop is running for (int i = 0; i < 15000; i++) { qDebug() << "Timezone: " << localnow.timeZone(); qDebug() << "Date: " << localnow; qDebug() << "" ; }
QtCreators application output shows the change on the timezone only when timezone() called:
Timezone: QTimeZone("America/Santa_Isabel")
Date: QDateTime(2015-10-01 03:33:09.782 Pacific Daylight Time (Mexico) Qt::TimeSpec(LocalTime))
Timezone: QTimeZone("Pacific/Guadalcanal")
Date: QDateTime(2015-10-01 03:33:09.782 Pacific Daylight Time (Mexico) Qt::TimeSpec(LocalTime))
When the application is started again also the localnow1; has the updated timezone:
Timezone: QTimeZone("Pacific/Guadalcanal")
Date: QDateTime(2015-10-01 21:35:31.765 Central Pacific Standard Time Qt::TimeSpec(LocalTime))
Attachments
Issue Links
- relates to
-
QTBUG-56899 Add a static QTimeZone method to refresh system zone information
- Open