diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2010-03-25 15:54:51 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2010-03-25 15:54:51 (GMT) |
commit | 3671dbf34940e166b747b6f8f3f5758fd486073c (patch) | |
tree | 73dfe3d7d5150f4f6cbeac8ead747eedfd323123 /src/corelib/kernel/qcore_unix.cpp | |
parent | 194013d9db1b3e4ba6f56a864f3b64f523202948 (diff) | |
parent | 3343298448da3f2546b0708670effb798f762c5c (diff) | |
download | Qt-3671dbf34940e166b747b6f8f3f5758fd486073c.zip Qt-3671dbf34940e166b747b6f8f3f5758fd486073c.tar.gz Qt-3671dbf34940e166b747b6f8f3f5758fd486073c.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1 into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1: (153 commits)
Use QTRY_COMPARE after QTest::qWaitForWindowShown()
Use the new memory cost reporting API in QtScript Custom Class example
QtScript: Add API for reporting additional memory costs
Add experimental support for StaticContents in Mac OS X.
Fix misspelling in function name.
don't just return the first key here.
Fix CI sytem build breakage.
Fix crash.
Compile with QT_NO_NETWORKINTERFACE defined.
Don't emit signals in constructor.
Remove unused code.
fix multiple promps for keychain access when connecting to wifi network
not all interfaces should be active
Update changelog
Fix qcombobox:flaggedItems autotest failure.
Wrong value for PM_ScrollBarExtent on Windows XP.
doc: Fixed all the remaining qdoc errors. For now.
Do not move keyboard focus to invisible windows on X11.
Do not use _NET_ACTIVE_WINDOW for nonmanaged windows.
Revert "Revert "Make QWidget::activateWindow() NET window manager aware.""
...
Diffstat (limited to 'src/corelib/kernel/qcore_unix.cpp')
-rw-r--r-- | src/corelib/kernel/qcore_unix.cpp | 65 |
1 files changed, 2 insertions, 63 deletions
diff --git a/src/corelib/kernel/qcore_unix.cpp b/src/corelib/kernel/qcore_unix.cpp index 0fd965b..e0d92c0 100644 --- a/src/corelib/kernel/qcore_unix.cpp +++ b/src/corelib/kernel/qcore_unix.cpp @@ -40,6 +40,7 @@ ****************************************************************************/ #include "qcore_unix_p.h" +#include "qelapsedtimer.h" #ifndef Q_OS_VXWORKS # if !defined(Q_OS_HPUX) || defined(__ia64) @@ -56,74 +57,12 @@ #include <mach/mach_time.h> #endif -#if !defined(QT_NO_CLOCK_MONOTONIC) -# if defined(QT_BOOTSTRAPPED) -# define QT_NO_CLOCK_MONOTONIC -# endif -#endif - QT_BEGIN_NAMESPACE -bool qt_gettime_is_monotonic() -{ -#if (_POSIX_MONOTONIC_CLOCK-0 > 0) || defined(Q_OS_MAC) - return true; -#else - static int returnValue = 0; - - if (returnValue == 0) { -# if (_POSIX_MONOTONIC_CLOCK-0 < 0) - returnValue = -1; -# elif (_POSIX_MONOTONIC_CLOCK == 0) - // detect if the system support monotonic timers - long x = sysconf(_SC_MONOTONIC_CLOCK); - returnValue = (x >= 200112L) ? 1 : -1; -# endif - } - - return returnValue != -1; -#endif -} - -timeval qt_gettime() -{ - timeval tv; -#if defined(Q_OS_MAC) - static mach_timebase_info_data_t info = {0,0}; - if (info.denom == 0) - mach_timebase_info(&info); - - uint64_t cpu_time = mach_absolute_time(); - uint64_t nsecs = cpu_time * (info.numer / info.denom); - tv.tv_sec = nsecs / 1000000000ull; - tv.tv_usec = (nsecs / 1000) - (tv.tv_sec * 1000000); - return tv; -#elif (_POSIX_MONOTONIC_CLOCK-0 > 0) - timespec ts; - clock_gettime(CLOCK_MONOTONIC, &ts); - tv.tv_sec = ts.tv_sec; - tv.tv_usec = ts.tv_nsec / 1000; - return tv; -#else -# if !defined(QT_NO_CLOCK_MONOTONIC) && !defined(QT_BOOTSTRAPPED) - if (qt_gettime_is_monotonic()) { - timespec ts; - clock_gettime(CLOCK_MONOTONIC, &ts); - tv.tv_sec = ts.tv_sec; - tv.tv_usec = ts.tv_nsec / 1000; - return tv; - } -# endif - // use gettimeofday - ::gettimeofday(&tv, 0); - return tv; -#endif -} - static inline bool time_update(struct timeval *tv, const struct timeval &start, const struct timeval &timeout) { - if (!qt_gettime_is_monotonic()) { + if (!QElapsedTimer::isMonotonic()) { // we cannot recalculate the timeout without a monotonic clock as the time may have changed return false; } |