diff options
author | John Layt <jlayt@kde.org> | 2013-09-28 16:46:19 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-10-31 22:01:40 +0100 |
commit | 24733dea6c5c5500d3c01fcfa46c2b05d7557b47 (patch) | |
tree | 238bc09692595e6b8a5e6c0c5f43e1ce6a397a06 /src | |
parent | 1da1259c281f2098ae11d928f1664cf00d379076 (diff) |
QDateTime - Optimize refreshDateTime()
A small optimization to the private refreshDateTime() function, improves
standard performance tests by 0.3 msecs per iteration for affected
functions, e.g. isValid() and offsetFromUtc() improve from 5.4 to 5.1.
Change-Id: Ie67812649ef244388b484af35848b09d92dee38a
Reviewed-by: Mitch Curtis <mitch.curtis@digia.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/tools/qdatetime.cpp | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp index 935fd65ae1..42721c018f 100644 --- a/src/corelib/tools/qdatetime.cpp +++ b/src/corelib/tools/qdatetime.cpp @@ -2765,9 +2765,6 @@ void QDateTimePrivate::refreshDateTime() } // We have a valid date and time and a Qt::LocalTime or Qt::TimeZone that needs calculating - QDate date; - QTime time; - getDateTime(&date, &time); // LocalTime and TimeZone might fall into "missing" DaylightTime transition hour // Calling toEpochMSecs will adjust the returned date/time if it does QDate testDate; @@ -2781,7 +2778,7 @@ void QDateTimePrivate::refreshDateTime() epochMSecs = zoneMSecsToEpochMSecs(m_msecs, m_timeZone, &testDate, &testTime); #endif // QT_BOOTSTRAPPED } - if (testDate == date && testTime == time) { + if (timeToMSecs(testDate, testTime) == m_msecs) { setValidDateTime(); // Cache the offset to use in toMSecsSinceEpoch() m_offsetFromUtc = (m_msecs - epochMSecs) / 1000; |