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>
This commit is contained in:
parent
6616823fb7
commit
6c624c80fd
@ -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: {
|
||||
|
Loading…
x
Reference in New Issue
Block a user