summaryrefslogtreecommitdiffstats
path: root/src/corelib/kernel/qcore_unix.cpp
diff options
context:
space:
mode:
authorBradley T. Hughes <bradley.hughes@nokia.com>2009-07-27 11:31:43 (GMT)
committerBradley T. Hughes <bradley.hughes@nokia.com>2009-07-27 11:32:29 (GMT)
commitfb49d313e30fca8c3af58ecc7ed4310c78e99b79 (patch)
tree23697e44372024824e77c48f5c08757e31d8d68d /src/corelib/kernel/qcore_unix.cpp
parent1edad2af19ee67c3e3504c8226fc3cfef9fd51a1 (diff)
downloadQt-fb49d313e30fca8c3af58ecc7ed4310c78e99b79.zip
Qt-fb49d313e30fca8c3af58ecc7ed4310c78e99b79.tar.gz
Qt-fb49d313e30fca8c3af58ecc7ed4310c78e99b79.tar.bz2
Avoid floating point code when converting Mach time to timeval
Mac OS X only change Reviewed-by: Thiago
Diffstat (limited to 'src/corelib/kernel/qcore_unix.cpp')
-rw-r--r--src/corelib/kernel/qcore_unix.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/corelib/kernel/qcore_unix.cpp b/src/corelib/kernel/qcore_unix.cpp
index 6ef56fd..d0a4d8f 100644
--- a/src/corelib/kernel/qcore_unix.cpp
+++ b/src/corelib/kernel/qcore_unix.cpp
@@ -86,8 +86,8 @@ timeval qt_gettime()
uint64_t cpu_time = mach_absolute_time();
uint64_t nsecs = cpu_time * (info.numer / info.denom);
- tv.tv_sec = nsecs * 1e-9;
- tv.tv_usec = nsecs * 1e-3 - (t.tv_sec * 1e6);
+ tv.tv_sec = nsecs / 1000000000ull;
+ tv.tv_usec = (nsecs / 1000) - (t.tv_sec * 1000000);
return tv;
#elif (_POSIX_MONOTONIC_CLOCK-0 > 0)
timespec ts;