diff options
author | Edward Welbourne <edward.welbourne@qt.io> | 2021-09-27 11:42:24 +0200 |
---|---|---|
committer | Edward Welbourne <edward.welbourne@qt.io> | 2021-10-04 16:03:36 +0200 |
commit | 3a8c8e7cf620883af0e2b7ba6bfb1e5fced46b42 (patch) | |
tree | 69c50ead1312029b678e3532aeaed72ef34ee825 /src/corelib/time/qdatetime.cpp | |
parent | e0ecb0ded21082f4e00ee77411339009cb1294a4 (diff) |
Remove an overly-complex assertion
It tried to sanity-check the correction being made to the time as a
result of converting zone to UTC, but handling also the case where the
correction avoided a gap. However, there are too many quirky cases to
permit a simple condition. The latest to trip it up is a case of a
zone leaving local solar mean time; a time in the gap that hits is
shunted by the width of the gap, which could be any old thing, and
won't show up on the data describing the zone before or after the
transition.
In any case, one branch of the check was doubling the zone's standard
time offset, which makes no sense. As that was checking for
double-DST, it would need to check standard offset plus twice the
usual DST offset; but the data it's looking at probably has its DST
offset set to the doubled one that needs to deal with. In general a
change in DST without going via standard time will have problems here,
and a change to standard time could also present problems.
Stop trying to shore up the assert and just trust the offset we got.
Change-Id: I4519f47e79dfb7595f4a12c259b80a338bc7033c
Reviewed-by: Andreas Buhr <andreas.buhr@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/time/qdatetime.cpp')
-rw-r--r-- | src/corelib/time/qdatetime.cpp | 9 |
1 files changed, 0 insertions, 9 deletions
diff --git a/src/corelib/time/qdatetime.cpp b/src/corelib/time/qdatetime.cpp index ab3d923ef9..cdfe0287d6 100644 --- a/src/corelib/time/qdatetime.cpp +++ b/src/corelib/time/qdatetime.cpp @@ -3424,15 +3424,6 @@ inline qint64 QDateTimePrivate::zoneMSecsToEpochMSecs(qint64 zoneMSecs, const QT *zoneTime = QTime(); } else { Q_ASSERT(zone.d->offsetFromUtc(data.atMSecsSinceEpoch) == data.offsetFromUtc); - Q_ASSERT(([data](qint64 offset) { - return offset == data.offsetFromUtc - // When zoneMSecs falls in a spring-forward's gap: - || offset == data.standardTimeOffset - // When it falls in the gap leading into double-DST: - || offset == 2 * data.standardTimeOffset - // When it falls in a skipped day (Pacific date-line crossings): - || (data.offsetFromUtc - offset) % SECS_PER_DAY == 0; - })((zoneMSecs - data.atMSecsSinceEpoch) / MSECS_PER_SEC)); msecsToTime(data.atMSecsSinceEpoch + data.offsetFromUtc * MSECS_PER_SEC, zoneDate, zoneTime); if (hint) { |