QElapsedTimer & QDeadlineTimer: use NSDMI for their two fields

Change-Id: Ieec322d73c1e40ad95c8fffd174654d643c05097
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 81783d02e89ee5ad49559bd9f0d7119180e86188)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Thiago Macieira 2023-02-22 18:59:50 -08:00 committed by Qt Cherry-pick Bot
parent 86aa3d8f3b
commit 98bb68addd
3 changed files with 7 additions and 12 deletions

View File

@ -431,7 +431,6 @@ inline bool TimeReference::toNanoseconds(qint64 *result) const
\sa hasExpired(), isForever(), remainingTime(), setRemainingTime()
*/
QDeadlineTimer::QDeadlineTimer(qint64 msecs, Qt::TimerType type) noexcept
: t2(0)
{
setRemainingTime(msecs, type);
}

View File

@ -26,9 +26,9 @@ public:
enum ForeverConstant { Forever };
constexpr QDeadlineTimer(Qt::TimerType type_ = Qt::CoarseTimer) noexcept
: t1(0), t2(0), type(type_) {}
: type(type_) {}
constexpr QDeadlineTimer(ForeverConstant, Qt::TimerType type_ = Qt::CoarseTimer) noexcept
: t1((std::numeric_limits<qint64>::max)()), t2(0), type(type_) {}
: t1((std::numeric_limits<qint64>::max)()), type(type_) {}
explicit QDeadlineTimer(qint64 msecs, Qt::TimerType type = Qt::CoarseTimer) noexcept;
void swap(QDeadlineTimer &other) noexcept
@ -141,8 +141,8 @@ public:
{ return dt = dt + value; }
private:
qint64 t1;
unsigned t2;
qint64 t1 = 0;
unsigned t2 = 0;
unsigned type;
qint64 rawRemainingTimeNSecs() const noexcept;

View File

@ -21,11 +21,7 @@ public:
PerformanceCounter
};
constexpr QElapsedTimer()
: t1(Q_INT64_C(0x8000000000000000)),
t2(Q_INT64_C(0x8000000000000000))
{
}
constexpr QElapsedTimer() = default;
static ClockType clockType() noexcept;
static bool isMonotonic() noexcept;
@ -51,8 +47,8 @@ public:
friend bool Q_CORE_EXPORT operator<(const QElapsedTimer &lhs, const QElapsedTimer &rhs) noexcept;
private:
qint64 t1;
qint64 t2;
qint64 t1 = Q_INT64_C(0x8000000000000000);
qint64 t2 = Q_INT64_C(0x8000000000000000);
};
QT_END_NAMESPACE