Convert the one extant use of QTime as a timer to use a local class

Use QDateTime::currentMSecsSinceEpoch() instead of a QTime with funky
wrapping at midnight and potential DST glitches.

Change-Id: I2455db5778635fc00b4ffdef6edee6d6793e50eb
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
bb10
Edward Welbourne 2019-05-24 14:40:54 +02:00
parent 325d5b58a2
commit 9ff6df8929
1 changed files with 17 additions and 2 deletions

View File

@ -1,6 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the tools applications of the Qt Toolkit.
@ -52,6 +52,21 @@
#define QT_POPEN_READ "r"
#endif
class ActionTimer
{
qint64 started;
public:
ActionTimer() = default;
void start()
{
started = QDateTime::currentMSecsSinceEpoch();
}
int elapsed()
{
return int(QDateTime::currentMSecsSinceEpoch() - started);
}
};
static const bool mustReadOutputAnyway = true; // pclose seems to return the wrong error code unless we read the output
void deleteRecursively(const QString &dirName)
@ -138,7 +153,7 @@ struct Options
bool gradle;
bool auxMode;
bool stripLibraries = true;
QTime timer;
ActionTimer timer;
// External tools
QString sdkPath;