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>
bb10
Thiago Macieira 2016-04-29 23:14:01 -07:00
parent 5e059c6047
commit 0d0141d746
1 changed files with 5 additions and 1 deletions

View File

@ -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