Skip QTimeZone::isTimeZoneIdAvailable()'s validity check on Unix
[ChangeLog][Corelib][QTimeZone] On Unix (other than macOS and Android), the TZ-DB backend has long accepted any well-formed POSIX zone description as a time-zone ID. This is now reflected in QTimeZone::isTimeZoneIdAvailable(), which previously claimed not to accept these IDs. However, avaliableTimeZoneIds() still does not attempt to construct all possible POSIX descriptors to include in its return. Change-Id: I1df8df0a4acaca9e70d72f13200b4c31305732f3 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
41c561ddde
commit
092563a3d0
@ -1347,12 +1347,18 @@ QTimeZone QTimeZone::utc()
|
||||
|
||||
bool QTimeZone::isTimeZoneIdAvailable(const QByteArray &ianaId)
|
||||
{
|
||||
#if defined(Q_OS_UNIX) && !(defined(Q_OS_ANDROID) || defined(Q_OS_DARWIN))
|
||||
// Keep #if-ery consistent with selection of QTzTimeZonePrivate in
|
||||
// newBackendTimeZone(). Skip the pre-check, as the TZ backend accepts POSIX
|
||||
// zone IDs, which need not be valid IANA IDs.
|
||||
#else
|
||||
// isValidId is not strictly required, but faster to weed out invalid
|
||||
// IDs as availableTimeZoneIds() may be slow
|
||||
if (!QTimeZonePrivate::isValidId(ianaId))
|
||||
return false;
|
||||
return QUtcTimeZonePrivate().isTimeZoneIdAvailable(ianaId) ||
|
||||
global_tz->backend->isTimeZoneIdAvailable(ianaId);
|
||||
#endif
|
||||
return QUtcTimeZonePrivate().isTimeZoneIdAvailable(ianaId)
|
||||
|| global_tz->backend->isTimeZoneIdAvailable(ianaId);
|
||||
}
|
||||
|
||||
static QList<QByteArray> set_union(const QList<QByteArray> &l1, const QList<QByteArray> &l2)
|
||||
|
Loading…
Reference in New Issue
Block a user