diff options
-rw-r--r-- | src/corelib/tools/qelapsedtimer_win.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/corelib/tools/qelapsedtimer_win.cpp b/src/corelib/tools/qelapsedtimer_win.cpp index 11cc140..4635bb8 100644 --- a/src/corelib/tools/qelapsedtimer_win.cpp +++ b/src/corelib/tools/qelapsedtimer_win.cpp @@ -81,7 +81,9 @@ static inline qint64 ticksToNanoseconds(qint64 ticks) { if (counterFrequency > 0) { // QueryPerformanceCounter uses an arbitrary frequency - return ticks * 1000000000 / counterFrequency; + qint64 seconds = ticks / counterFrequency; + qint64 nanoSeconds = (ticks - seconds * counterFrequency) * 1000000000 / counterFrequency; + return seconds * 1000000000 + nanoSeconds; } else { // GetTickCount(64) return milliseconds return ticks * 1000000; |