summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2017-04-10 08:37:08 -0700
committerThiago Macieira <thiago.macieira@intel.com>2017-04-11 06:45:41 +0000
commitd5f62f7bc7895815546cd2f6be9605486907018d (patch)
tree5c49a23fed5a50c9eada3e658874304a7c80bda0
parentdbea118f120a781e1aed717856bb7ab3d3ec86f1 (diff)
Ask MS runtime to reload the timezone details if they've changed
POSIX documents that localtime() ensures that tzset() has been called, but the wording could be understood to mean that it only needs to do so the first time. Anyway, we're sure that the MS runtime only gets the timezone information from the Control Panel once. That means Qt-based applications will not react to a change in the timezone. Attempt to do that by moving tzset() out of the #if, to apply to all operating systems. Task-number: QTBUG-60043 Change-Id: I6ab535fb61094af19fc1fffd14b413541fe5a64c Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
-rw-r--r--src/corelib/tools/qdatetime.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp
index a4a7aabacb..bcdbc5af2a 100644
--- a/src/corelib/tools/qdatetime.cpp
+++ b/src/corelib/tools/qdatetime.cpp
@@ -2287,10 +2287,11 @@ static bool qt_localtime(qint64 msecsSinceEpoch, QDate *localDate, QTime *localT
tm local;
bool valid = false;
-#if !defined(QT_NO_THREAD) && defined(_POSIX_THREAD_SAFE_FUNCTIONS)
// localtime() is required to work as if tzset() was called before it.
// localtime_r() does not have this requirement, so make an explicit call.
+ // The explicit call should also request the timezone info be re-parsed.
qt_tzset();
+#if !defined(QT_NO_THREAD) && defined(_POSIX_THREAD_SAFE_FUNCTIONS)
// Use the reentrant version of localtime() where available
// as is thread-safe and doesn't use a shared static data area
tm *res = 0;