diff options
author | Bradley T. Hughes <bradley.hughes@nokia.com> | 2009-06-02 10:02:14 (GMT) |
---|---|---|
committer | Bradley T. Hughes <bradley.hughes@nokia.com> | 2009-06-02 10:08:11 (GMT) |
commit | c46126179dfb12e01d5787fdd2278cfc0788d9fa (patch) | |
tree | bf9c2de2f7b5003e90470481076f9b8c035557f2 | |
parent | 785e08f74be80ac420b804dc3524558be2592b6b (diff) | |
download | Qt-c46126179dfb12e01d5787fdd2278cfc0788d9fa.zip Qt-c46126179dfb12e01d5787fdd2278cfc0788d9fa.tar.gz Qt-c46126179dfb12e01d5787fdd2278cfc0788d9fa.tar.bz2 |
Improve detection of monotonic timer support
Some older systems support monotonic timers, but not POSIX.1-2001. The
sysconf() function is documented to return -1 if a feature is not
supported, otherwise it returns a value that's dependent on it's
argument. For POSIX.1-2001 compliant system, the value is 200112L, but
on other systems it may just return 1, for example.
Because of this, we check for the -1 return value (feature missing),
instead of relying on a specific (positive) return value.
-rw-r--r-- | src/corelib/kernel/qeventdispatcher_unix.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/corelib/kernel/qeventdispatcher_unix.cpp b/src/corelib/kernel/qeventdispatcher_unix.cpp index 6aa3b56..1b9cb93 100644 --- a/src/corelib/kernel/qeventdispatcher_unix.cpp +++ b/src/corelib/kernel/qeventdispatcher_unix.cpp @@ -263,7 +263,7 @@ QTimerInfoList::QTimerInfoList() # if (_POSIX_MONOTONIC_CLOCK == 0) // detect if the system support monotonic timers long x = sysconf(_SC_MONOTONIC_CLOCK); - useMonotonicTimers = x >= 200112L; + useMonotonicTimers = x != -1; # endif getTime(currentTime); |