summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBradley T. Hughes <bradley.hughes@nokia.com>2009-06-02 10:02:14 (GMT)
committerBradley T. Hughes <bradley.hughes@nokia.com>2009-06-02 10:08:11 (GMT)
commitc46126179dfb12e01d5787fdd2278cfc0788d9fa (patch)
treebf9c2de2f7b5003e90470481076f9b8c035557f2 /src
parent785e08f74be80ac420b804dc3524558be2592b6b (diff)
downloadQt-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.
Diffstat (limited to 'src')
-rw-r--r--src/corelib/kernel/qeventdispatcher_unix.cpp2
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);