diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2015-02-15 21:01:39 +0100 |
---|---|---|
committer | Marc Mutz <marc.mutz@kdab.com> | 2015-02-21 16:58:46 +0000 |
commit | 878cbbcb65f0c872db6c719422d9a426976fa8b2 (patch) | |
tree | 3c2dc285dc431ff1b5823bb234f1bae069d6dfad /src | |
parent | de8a34b9bdd3d4fc6f5515e144741bf205adfe6a (diff) |
QDateTime: cache the result of date.timeSpec() in QDebug op<<
Saves a couple dozen bytes in text size on optimized AMD64 builds.
Change-Id: Iefd9ca05a7b27f240836c1e1e00df569742fcd7f
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/tools/qdatetime.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp index aaa639272c..eeefea8137 100644 --- a/src/corelib/tools/qdatetime.cpp +++ b/src/corelib/tools/qdatetime.cpp @@ -4965,10 +4965,11 @@ QDebug operator<<(QDebug dbg, const QTime &time) QDebug operator<<(QDebug dbg, const QDateTime &date) { QDebugStateSaver saver(dbg); + const Qt::TimeSpec ts = date.timeSpec(); dbg.nospace() << "QDateTime("; dbg.noquote() << date.toString(QStringLiteral("yyyy-MM-dd HH:mm:ss.zzz t")) - << ' ' << date.timeSpec(); - switch (date.d->m_spec) { + << ' ' << ts; + switch (ts) { case Qt::UTC: break; case Qt::OffsetFromUTC: |