diff options
author | Edward Welbourne <edward.welbourne@qt.io> | 2020-09-21 13:46:02 +0200 |
---|---|---|
committer | Edward Welbourne <edward.welbourne@qt.io> | 2020-09-23 16:59:08 +0200 |
commit | 1ec67b5e266864fb9d37f04e0239277b8e8978e2 (patch) | |
tree | 00e644557b994c8aa99f9d1b34526f60e896e278 /src/corelib/tools/qunicodetables.cpp | |
parent | 3bd6901429611636d254bb0140799b019112985d (diff) |
Make more consistent use of m_offsetFromUtc()
In QDateTime::toMSecsSinceEpoch(), all non-short date-times know their
offsets from UTC, so can use that, saving the TimeZone ones the need
to call (costly) zoneMSecsToEpochMSecs() and, when not short, the
LocalTime ones the need to call localMSecsToEpochMSecs().
Moved the setting of offset clear of refreshZonedDateTime()'s check
that the date and time match the milliseconds being handled, so that a
sensible offset value is set even when the date-time comes back
invalid due to being in a spring forward.
As refreshZonedDateTime() now sets d's m_offsetFromUtc for both specs,
it no longer needs QDateTimePrivate::setUtcOffsetByTZ(). In any case,
the private time-zone access that provided is equivalent to the
difference we already have between msecs and epochMSecs, except in a
zone-gap. Add assertions to confirm this in zoneMSecsToEpochMSecs().
This brought to light a problem with whole-day transitions, where
QDate::startOfDay() assumed the gap it was hitting would end by end of
day. Search backwards from noon tomorrow, instead; likewise, for
endOfDay(), search forward from yesterday.
Task-number: QTBUG-75585
Change-Id: I6151d1dfccab321605753c98e01152281461bfe2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/tools/qunicodetables.cpp')
0 files changed, 0 insertions, 0 deletions