summaryrefslogtreecommitdiffstats
path: root/src/corelib
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2016-04-29 23:14:01 -0700
committerThiago Macieira <thiago.macieira@intel.com>2016-04-30 18:24:15 +0000
commit0d0141d746e71f25fd68e1439f8251e4e476e332 (patch)
treea73ba06857309f45d42eabbe533eb63d79673d30 /src/corelib
parent5e059c6047a49568233b2379984ccd55614d43c5 (diff)
Don't bother asking if Linux supports a monotonic clock: it does
Change-Id: Id5480807d25e49e78b79ffff144a0e61bd001dff Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com> Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/tools/qelapsedtimer_unix.cpp6
1 files changed, 5 insertions, 1 deletions
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