diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2015-06-30 19:32:22 -0700 |
---|---|---|
committer | Thiago Macieira <thiago.macieira@intel.com> | 2015-07-15 04:53:37 +0000 |
commit | 6388b30e79e315262aef95c9825eaaffdfdd9d54 (patch) | |
tree | 33d8a9117ed7e366aa0a88873148fa0f5dd9fbd1 /src/corelib | |
parent | 86a79260ca77dddc25e6dc2023d24c070afb2831 (diff) |
Fix the printing of the ms-since-boot in %{time boot}
Commit 5d366f7e was not correct. The time displayed would always be the
same (the start time of the application).
[ChangeLog][QtCore][Logging framework] Fixed a bug that would cause a
"%{time boot}" field in the logging framework's pattern to always
display the same value, instead of the time since boot.
Change-Id: I255870833a024a36adf6ffff13ecb1dca4a688ed
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com>
Diffstat (limited to 'src/corelib')
-rw-r--r-- | src/corelib/global/qlogging.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/corelib/global/qlogging.cpp b/src/corelib/global/qlogging.cpp index 0846d2a6db..fca8656f9b 100644 --- a/src/corelib/global/qlogging.cpp +++ b/src/corelib/global/qlogging.cpp @@ -1359,8 +1359,9 @@ QString qFormatLogMessage(QtMsgType type, const QMessageLogContext &context, con } else if (pattern->timeFormat == QLatin1String("boot")) { // just print the milliseconds since the elapsed timer reference // like the Linux kernel does - pattern->timer.elapsed(); - uint ms = pattern->timer.msecsSinceReference(); + QElapsedTimer now; + now.start(); + uint ms = now.msecsSinceReference(); message.append(QString::asprintf("%6d.%03d", uint(ms / 1000), uint(ms % 1000))); } else if (pattern->timeFormat.isEmpty()) { message.append(QDateTime::currentDateTime().toString(Qt::ISODate)); |