Prefer ICU over system info on MS-Win
The ICU data is more complete; and its APIs allow it to tell the whole story, which MS-Win's APIs can't (e.g. Morocco's otherwise-normal DST has a hole in it for Ramadan; when this makes four transitions in a year, the MS-APIs can't report more than two, so ignore the Ramadan gap); and their design obliges us to use heuristics to kludge round mis-description of simple changes to standard time in non-DST zones, which can't be distinguished from certain (more) obscure cases of changes to DST coinciding with a change to standard offset (causing a DST transition to hide, leaving its other end *looking like* a non-DST change to standard offset). Using ICU, when available, reduces how many end users shall be mislead by such kludges. [ChangeLog][Windows][QTimeZone] Changed MS-Win to use ICU for time-zone data, when available, in preference to MS's TZ APIs. The choice is made when building Qt. This will give reliable results when non-DST transitions arise, or when a zone's DST is not simple (e.g. interrupted by Ramadan). Task-number: QTBUG-42021 Change-Id: I9cdd65713ecdaf8cce52dd924fbc7371630977c8 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>bb10
parent
aec6fae60b
commit
6d3e5ac6d2
|
|
@ -66,11 +66,10 @@ static QTimeZonePrivate *newBackendTimeZone()
|
|||
return new QAndroidTimeZonePrivate();
|
||||
#elif defined Q_OS_UNIX
|
||||
return new QTzTimeZonePrivate();
|
||||
// Registry based timezone backend not available on WinRT
|
||||
#elif defined Q_OS_WIN
|
||||
return new QWinTimeZonePrivate();
|
||||
#elif QT_CONFIG(icu)
|
||||
return new QIcuTimeZonePrivate();
|
||||
#elif defined Q_OS_WIN
|
||||
return new QWinTimeZonePrivate();
|
||||
#else
|
||||
return new QUtcTimeZonePrivate();
|
||||
#endif // System Locales
|
||||
|
|
@ -93,11 +92,10 @@ static QTimeZonePrivate *newBackendTimeZone(const QByteArray &ianaId)
|
|||
return new QAndroidTimeZonePrivate(ianaId);
|
||||
#elif defined Q_OS_UNIX
|
||||
return new QTzTimeZonePrivate(ianaId);
|
||||
// Registry based timezone backend not available on WinRT
|
||||
#elif defined Q_OS_WIN
|
||||
return new QWinTimeZonePrivate(ianaId);
|
||||
#elif QT_CONFIG(icu)
|
||||
return new QIcuTimeZonePrivate(ianaId);
|
||||
#elif defined Q_OS_WIN
|
||||
return new QWinTimeZonePrivate(ianaId);
|
||||
#else
|
||||
return new QUtcTimeZonePrivate(ianaId);
|
||||
#endif // System Locales
|
||||
|
|
|
|||
|
|
@ -49,6 +49,7 @@
|
|||
QT_BEGIN_NAMESPACE
|
||||
|
||||
#ifndef Q_OS_WINRT
|
||||
// The registry-based timezone backend is not available on WinRT, which falls back to equivalent APIs.
|
||||
#define QT_USE_REGISTRY_TIMEZONE 1
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -159,16 +159,18 @@ qtConfig(timezone) {
|
|||
SOURCES += \
|
||||
tools/qtimezone.cpp \
|
||||
tools/qtimezoneprivate.cpp
|
||||
!nacl:darwin: \
|
||||
!nacl:darwin: {
|
||||
SOURCES += tools/qtimezoneprivate_mac.mm
|
||||
else: android: \
|
||||
} else: android: {
|
||||
SOURCES += tools/qtimezoneprivate_android.cpp
|
||||
else: unix: \
|
||||
} else: unix: {
|
||||
SOURCES += tools/qtimezoneprivate_tz.cpp
|
||||
else: win32: \
|
||||
SOURCES += tools/qtimezoneprivate_win.cpp
|
||||
qtConfig(icu): \
|
||||
qtConfig(icu): SOURCES += tools/qtimezoneprivate_icu.cpp
|
||||
} else: qtConfig(icu): {
|
||||
SOURCES += tools/qtimezoneprivate_icu.cpp
|
||||
} else: win32: {
|
||||
SOURCES += tools/qtimezoneprivate_win.cpp
|
||||
}
|
||||
}
|
||||
|
||||
qtConfig(datetimeparser) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue