QWinTimeZonePrivate::availableTimeZoneIds(): cache result
This follows up on commit d59e539b3a1252aa22783c4fdf1e22b35e5a4292, doing the same for one of its callers. The mapping from windows IDs to IANA ones is hard-coded (using CLDR-generated data), so the (now unchanging) availableWindowsIds() list shall always map to the same list of IANA IDs. Pick-to: 6.6 6.5 Task-number: QTBUG-120682 Change-Id: I4d610c24110064236b375cab04cde90bbe07735f Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> (cherry picked from commit 83871413636407f196c2ef7ca4e5b0a846c646ec) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
44b6b3870a
commit
6df9074a1a
@ -849,13 +849,16 @@ QByteArray QWinTimeZonePrivate::systemTimeZoneId() const
|
||||
|
||||
QList<QByteArray> QWinTimeZonePrivate::availableTimeZoneIds() const
|
||||
{
|
||||
QList<QByteArray> result;
|
||||
const auto winIds = availableWindowsIds();
|
||||
for (const QByteArray &winId : winIds)
|
||||
result += windowsIdToIanaIds(winId);
|
||||
std::sort(result.begin(), result.end());
|
||||
result.erase(std::unique(result.begin(), result.end()), result.end());
|
||||
return result;
|
||||
static const QList<QByteArray> cache = [] {
|
||||
QList<QByteArray> result;
|
||||
const auto winIds = availableWindowsIds();
|
||||
for (const QByteArray &winId : winIds)
|
||||
result += windowsIdToIanaIds(winId);
|
||||
std::sort(result.begin(), result.end());
|
||||
result.erase(std::unique(result.begin(), result.end()), result.end());
|
||||
return result;
|
||||
}();
|
||||
return cache;
|
||||
}
|
||||
|
||||
QTimeZonePrivate::Data QWinTimeZonePrivate::ruleToData(const QWinTransitionRule &rule,
|
||||
|
Loading…
x
Reference in New Issue
Block a user