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>
This commit is contained in:
Marc Mutz 2015-02-15 21:01:39 +01:00
parent de8a34b9bd
commit 878cbbcb65

View File

@ -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: