diff options
| author | Edward Welbourne <edward.welbourne@qt.io> | 2022-09-01 18:24:30 +0200 |
|---|---|---|
| committer | Edward Welbourne <edward.welbourne@qt.io> | 2022-09-07 15:53:16 +0200 |
| commit | 6c624c80fd9f2b5d43dabf955ef42657c8d029bd (patch) | |
| tree | 0e361dbdebeefda804513efce19c78a9fd9a111a /src | |
| parent | 6616823fb783c60186e50b5507902c3f9ec5760f (diff) | |
| download | qtbase-6c624c80fd9f2b5d43dabf955ef42657c8d029bd.tar.gz | |
Avoid recomputing DST-ness for time-zone when already known
When a QDateTime is constructed it determines whether daylight-saving
time is in effect and records it in its status field. So consult that
cached answer first, before asking the time-zone backend to work out
the answer the slow way.
Change-Id: I1d380d41f28a9b866216ac0f65425c30a8988cac
Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
Diffstat (limited to 'src')
| -rw-r--r-- | src/corelib/time/qdatetime.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/corelib/time/qdatetime.cpp b/src/corelib/time/qdatetime.cpp index 865e9befdf..418466033d 100644 --- a/src/corelib/time/qdatetime.cpp +++ b/src/corelib/time/qdatetime.cpp @@ -3613,6 +3613,10 @@ bool QDateTime::isDaylightTime() const break; #else Q_ASSERT(d->m_timeZone.isValid()); + if (auto dst = extractDaylightStatus(getStatus(d)); + dst != QDateTimePrivate::UnknownDaylightTime) { + return dst == QDateTimePrivate::DaylightTime; + } return d->m_timeZone.d->isDaylightTime(toMSecsSinceEpoch()); #endif // timezone case Qt::LocalTime: { |
