diff options
author | Edward Welbourne <edward.welbourne@qt.io> | 2021-02-16 15:36:40 +0100 |
---|---|---|
committer | Edward Welbourne <edward.welbourne@qt.io> | 2021-02-18 11:20:54 +0100 |
commit | 76c2e9ea23e6bf9e9783813c89c80737ac72d468 (patch) | |
tree | 977d65402f838e3c9a87bb6c568810464bb8da93 /src/corelib | |
parent | 1b34d68623b85033784816292fbba67341c56043 (diff) |
Fix a typo, simplify an increment, add an assertion
Trivial details picked up during the course of investigating a
time-zone issue.
Change-Id: I4d6e7ab1787a2500bd950e7f12ed8618a31f1f8e
Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Diffstat (limited to 'src/corelib')
-rw-r--r-- | src/corelib/time/qdatetime.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/corelib/time/qdatetime.cpp b/src/corelib/time/qdatetime.cpp index 42b9ffcc47..743a94ab7a 100644 --- a/src/corelib/time/qdatetime.cpp +++ b/src/corelib/time/qdatetime.cpp @@ -3844,7 +3844,7 @@ qint64 QDateTime::toMSecsSinceEpoch() const case Qt::TimeZone: Q_ASSERT(!d.isShort()); #if QT_CONFIG(timezone) - // Use offset refreshZonedDateTime() saved creation: + // Use offset refreshZonedDateTime() saved on creation: if (d->m_timeZone.isValid()) return d->m_msecs - d->m_offsetFromUtc * 1000; #endif @@ -3899,7 +3899,7 @@ void QDateTime::setMSecsSinceEpoch(qint64 msecs) status |= QDateTimePrivate::ValidWhenMask; break; case Qt::OffsetFromUTC: - msecs = msecs + (d->m_offsetFromUtc * 1000); + msecs += d->m_offsetFromUtc * 1000; status |= QDateTimePrivate::ValidWhenMask; break; case Qt::TimeZone: @@ -3947,8 +3947,10 @@ void QDateTime::setMSecsSinceEpoch(qint64 msecs) d->m_msecs = msecs; } - if (spec == Qt::LocalTime || spec == Qt::TimeZone) + if (spec == Qt::LocalTime || spec == Qt::TimeZone) { refreshZonedDateTime(d, spec); + Q_ASSERT((d.isShort() ? d.data.msecs : d->m_msecs) == msecs); + } } /*! |