diff options
author | Ahmad Samir <a.samirh78@gmail.com> | 2023-02-21 15:54:04 +0200 |
---|---|---|
committer | Ahmad Samir <a.samirh78@gmail.com> | 2023-02-24 18:30:29 +0200 |
commit | 39a4cd126f177355e326238d95baaeaf845e9453 (patch) | |
tree | 7469a99ff59caa910df0fcdd076558dbed7cf60d /src/corelib/kernel/qtimerinfo_unix.cpp | |
parent | 738c48244bb7fe2a29e5f8f537a6f6c2ebb33008 (diff) |
q_core_unix_p.h: use std::chrono for time intervals
Also move some timespec helpers from qtimerinfo_unix.cpp to
q_core_unix_p.h, so that similar functions are grouped in one place.
Change-Id: I817733dd70607a1f4243a9745626f5c9b37ddc2a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/kernel/qtimerinfo_unix.cpp')
-rw-r--r-- | src/corelib/kernel/qtimerinfo_unix.cpp | 26 |
1 files changed, 0 insertions, 26 deletions
diff --git a/src/corelib/kernel/qtimerinfo_unix.cpp b/src/corelib/kernel/qtimerinfo_unix.cpp index 2aeb7eebf0..0a9e7e0a6a 100644 --- a/src/corelib/kernel/qtimerinfo_unix.cpp +++ b/src/corelib/kernel/qtimerinfo_unix.cpp @@ -58,19 +58,6 @@ timespec QTimerInfoList::updateCurrentTime() #if ((_POSIX_MONOTONIC_CLOCK-0 <= 0) && !defined(Q_OS_MAC) && !defined(Q_OS_INTEGRITY)) || defined(QT_BOOTSTRAPPED) -timespec qAbsTimespec(const timespec &t) -{ - timespec tmp = t; - if (tmp.tv_sec < 0) { - tmp.tv_sec = -tmp.tv_sec - 1; - tmp.tv_nsec -= 1000000000; - } - if (tmp.tv_sec == 0 && tmp.tv_nsec < 0) { - tmp.tv_nsec = -tmp.tv_nsec; - } - return normalizedTimespec(tmp); -} - /* Returns \c true if the real time clock has changed by more than 10% relative to the processor time since the last time this function was @@ -149,19 +136,6 @@ void QTimerInfoList::timerInsert(QTimerInfo *ti) insert(index+1, ti); } -inline timespec &operator+=(timespec &t1, int ms) -{ - t1.tv_sec += ms / 1000; - t1.tv_nsec += ms % 1000 * 1000 * 1000; - return normalizedTimespec(t1); -} - -inline timespec operator+(const timespec &t1, int ms) -{ - timespec t2 = t1; - return t2 += ms; -} - static constexpr timespec roundToMillisecond(timespec val) { // always round up |