Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1797)

Unified Diff: util/misc/clock_win.cc

Issue 1419533014: win: Fix ClockMonotonicNanoseconds() (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: util/misc/clock_win.cc
diff --git a/util/misc/clock_win.cc b/util/misc/clock_win.cc
index 731e98d4ee29da76306d598f4ee02ec64cffa99d..7231205decef22842a4a65745dcfe268ed40e0c6 100644
--- a/util/misc/clock_win.cc
+++ b/util/misc/clock_win.cc
@@ -39,7 +39,7 @@ uint64_t ClockMonotonicNanoseconds() {
QueryPerformanceCounter(&time);
int64_t frequency = QpcFrequency();
int64_t whole_seconds = time.QuadPart / frequency;
- int64_t leftover_ticks = time.QuadPart / (whole_seconds * frequency);
+ int64_t leftover_ticks = time.QuadPart % frequency;
scottmg 2015/11/05 18:49:58 frequency = 10, time.QuadPart = 98 whole_seconds
Mark Mentovai 2015/11/05 18:58:10 scottmg wrote:
const int64_t kNanosecondsPerSecond = static_cast<const int64_t>(1E9);
return (whole_seconds * kNanosecondsPerSecond) +
((leftover_ticks * kNanosecondsPerSecond) / frequency);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698