summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2015-01-22 19:28:01 +0100
committerMarc Mutz <marc.mutz@kdab.com>2015-03-25 10:18:35 +0000
commitaab749487f620e27b7311c729de3922e7fd09049 (patch)
tree64afc632c6877364c8cae4249f79f35142a4a300 /src/corelib/tools
parent1e824bb9c43a01cecb222ebbf373bca727aa5896 (diff)
QTime: optimize toString()
Instead of using a QString::arg() cascade, which creates tons of temporaries, use good 'ol sprintf(). Effects on Linux GCC 4.9 stripped release builds: text -308B data +-0B relocs +-0 Change-Id: I348577491d1399b5040f7ed9e9f6b111a9528e5d Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/tools')
-rw-r--r--src/corelib/tools/qdatetime.cpp4
1 files changed, 1 insertions, 3 deletions
diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp
index 8c25994bb2..7d1ed9d2ba 100644
--- a/src/corelib/tools/qdatetime.cpp
+++ b/src/corelib/tools/qdatetime.cpp
@@ -1569,9 +1569,7 @@ QString QTime::toString(Qt::DateFormat format) const
case Qt::ISODate:
case Qt::TextDate:
default:
- return QString::fromLatin1("%1:%2:%3").arg(hour(), 2, 10, QLatin1Char('0'))
- .arg(minute(), 2, 10, QLatin1Char('0'))
- .arg(second(), 2, 10, QLatin1Char('0'));
+ return QString::asprintf("%02d:%02d:%02d", hour(), minute(), second());
}
}