Use QDeadlineTimer in qlogging.cpp

No change, just shorter code.

Change-Id: I25d85d86649448d5b2b3fffd1450f95b0ec66927
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
This commit is contained in:
Thiago Macieira 2016-05-22 12:07:28 -07:00
parent c000143ee4
commit af520c8ef3

View File

@ -53,6 +53,7 @@
#include "qloggingcategory.h" #include "qloggingcategory.h"
#ifndef QT_BOOTSTRAPPED #ifndef QT_BOOTSTRAPPED
#include "qelapsedtimer.h" #include "qelapsedtimer.h"
#include "qdeadlinetimer.h"
#include "qdatetime.h" #include "qdatetime.h"
#include "qcoreapplication.h" #include "qcoreapplication.h"
#include "qthread.h" #include "qthread.h"
@ -1456,9 +1457,7 @@ QString qFormatLogMessage(QtMsgType type, const QMessageLogContext &context, con
} else if (timeFormat == QLatin1String("boot")) { } else if (timeFormat == QLatin1String("boot")) {
// just print the milliseconds since the elapsed timer reference // just print the milliseconds since the elapsed timer reference
// like the Linux kernel does // like the Linux kernel does
QElapsedTimer now; uint ms = QDeadlineTimer::current().deadline();
now.start();
uint ms = now.msecsSinceReference();
message.append(QString::asprintf("%6d.%03d", uint(ms / 1000), uint(ms % 1000))); message.append(QString::asprintf("%6d.%03d", uint(ms / 1000), uint(ms % 1000)));
#if QT_CONFIG(datestring) #if QT_CONFIG(datestring)
} else if (timeFormat.isEmpty()) { } else if (timeFormat.isEmpty()) {