From 0d0141d746e71f25fd68e1439f8251e4e476e332 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 29 Apr 2016 23:14:01 -0700 Subject: Don't bother asking if Linux supports a monotonic clock: it does Change-Id: Id5480807d25e49e78b79ffff144a0e61bd001dff Reviewed-by: Olivier Goffart (Woboq GmbH) Reviewed-by: Lars Knoll --- src/corelib/tools/qelapsedtimer_unix.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/corelib') diff --git a/src/corelib/tools/qelapsedtimer_unix.cpp b/src/corelib/tools/qelapsedtimer_unix.cpp index 1e672531c8..e1fc77fb4c 100644 --- a/src/corelib/tools/qelapsedtimer_unix.cpp +++ b/src/corelib/tools/qelapsedtimer_unix.cpp @@ -115,7 +115,11 @@ static inline void qt_clock_gettime(clockid_t clock, struct timespec *ts) static int unixCheckClockType() { -#if (_POSIX_MONOTONIC_CLOCK-0 == 0) && defined(_SC_MONOTONIC_CLOCK) +#ifdef Q_OS_LINUX + // Despite glibc claiming that we should check at runtime, the Linux kernel + // always supports the monotonic clock + return CLOCK_MONOTONIC; +#elif (_POSIX_MONOTONIC_CLOCK-0 == 0) && defined(_SC_MONOTONIC_CLOCK) // we need a value we can store in a clockid_t that isn't a valid clock // check if the valid ones are both non-negative or both non-positive # if CLOCK_MONOTONIC >= 0 && CLOCK_REALTIME >= 0 -- cgit v1.2.3