20 TickCounter Q_DECL_ENUMERATOR_DEPRECATED_X(
21 "Not supported anymore. Use PerformanceCounter instead."),
27 using Duration = std::chrono::nanoseconds;
28 using TimePoint = std::chrono::time_point<std::chrono::steady_clock, Duration>;
30 constexpr QElapsedTimer() =
default;
32 static ClockType clockType()
noexcept;
33 static bool isMonotonic()
noexcept;
35 void start()
noexcept;
36 qint64 restart()
noexcept;
37 void invalidate()
noexcept;
38 bool isValid()
const noexcept;
40 Duration durationElapsed()
const noexcept;
41 qint64 nsecsElapsed()
const noexcept;
42 qint64 elapsed()
const noexcept;
43 bool hasExpired(qint64 timeout)
const noexcept;
45 qint64 msecsSinceReference()
const noexcept;
46 Duration durationTo(
const QElapsedTimer &other)
const noexcept;
47 qint64 msecsTo(
const QElapsedTimer &other)
const noexcept;
48 qint64 secsTo(
const QElapsedTimer &other)
const noexcept;
49 friend bool Q_CORE_EXPORT operator<(
const QElapsedTimer &lhs,
const QElapsedTimer &rhs)
noexcept;
52 friend bool comparesEqual(
const QElapsedTimer &lhs,
const QElapsedTimer &rhs)
noexcept
54 return lhs.t1 == rhs.t1 && lhs.t2 == rhs.t2;
56 Q_DECLARE_EQUALITY_COMPARABLE(QElapsedTimer)
58 friend Qt::strong_ordering compareThreeWay(
const QElapsedTimer &lhs,
59 const QElapsedTimer &rhs)
noexcept
61 return Qt::compareThreeWay(lhs.t1, rhs.t1);
64#if defined(__cpp_lib_three_way_comparison)
65 friend std::strong_ordering
66 operator<=>(
const QElapsedTimer &lhs,
const QElapsedTimer &rhs)
noexcept
68 return compareThreeWay(lhs, rhs);
71 friend bool operator>(
const QElapsedTimer &lhs,
const QElapsedTimer &rhs)
noexcept
73 return is_gt(compareThreeWay(lhs, rhs));
75 friend bool operator<=(
const QElapsedTimer &lhs,
const QElapsedTimer &rhs)
noexcept
77 return is_lteq(compareThreeWay(lhs, rhs));
79 friend bool operator>=(
const QElapsedTimer &lhs,
const QElapsedTimer &rhs)
noexcept
81 return is_gteq(compareThreeWay(lhs, rhs));
84 qint64 t1 = Q_INT64_C(0x8000000000000000);
85 qint64 t2 = Q_INT64_C(0x8000000000000000);