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>
bb10
Thiago Macieira 2017-04-10 08:37:08 -07:00
parent dbea118f12
commit d5f62f7bc7
1 changed files with 2 additions and 1 deletions

View File

@ -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;