21 TickCounter Q_DECL_ENUMERATOR_DEPRECATED_X(
22 "Not supported anymore. Use PerformanceCounter instead."),
28 using Duration = std::chrono::nanoseconds;
29 using TimePoint = std::chrono::time_point<std::chrono::steady_clock, Duration>;
31 constexpr QElapsedTimer() =
default;
33 static ClockType clockType()
noexcept;
34 static bool isMonotonic()
noexcept;
36 void start()
noexcept;
37 qint64 restart()
noexcept;
38 void invalidate()
noexcept;
39 bool isValid()
const noexcept;
41 Duration durationElapsed()
const noexcept;
42 qint64 nsecsElapsed()
const noexcept;
43 qint64 elapsed()
const noexcept;
44 bool hasExpired(qint64 timeout)
const noexcept;
46 qint64 msecsSinceReference()
const noexcept;
47 Duration durationTo(
const QElapsedTimer &other)
const noexcept;
48 qint64 msecsTo(
const QElapsedTimer &other)
const noexcept;
49 qint64 secsTo(
const QElapsedTimer &other)
const noexcept;
50 friend bool Q_CORE_EXPORT operator<(
const QElapsedTimer &lhs,
const QElapsedTimer &rhs)
noexcept;
53 friend bool comparesEqual(
const QElapsedTimer &lhs,
const QElapsedTimer &rhs)
noexcept
55 return lhs.t1 == rhs.t1 && lhs.t2 == rhs.t2;
57 Q_DECLARE_EQUALITY_COMPARABLE(QElapsedTimer)
59 friend Qt::strong_ordering compareThreeWay(
const QElapsedTimer &lhs,
60 const QElapsedTimer &rhs)
noexcept
62 return Qt::compareThreeWay(lhs.t1, rhs.t1);
65#if defined(__cpp_lib_three_way_comparison)
66 friend std::strong_ordering
67 operator<=>(
const QElapsedTimer &lhs,
const QElapsedTimer &rhs)
noexcept
69 return compareThreeWay(lhs, rhs);
72 friend bool operator>(
const QElapsedTimer &lhs,
const QElapsedTimer &rhs)
noexcept
74 return is_gt(compareThreeWay(lhs, rhs));
76 friend bool operator<=(
const QElapsedTimer &lhs,
const QElapsedTimer &rhs)
noexcept
78 return is_lteq(compareThreeWay(lhs, rhs));
80 friend bool operator>=(
const QElapsedTimer &lhs,
const QElapsedTimer &rhs)
noexcept
82 return is_gteq(compareThreeWay(lhs, rhs));
85 qint64 t1 = Q_INT64_C(0x8000000000000000);
86 qint64 t2 = Q_INT64_C(0x8000000000000000);