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

Unified Diff: runtime/bin/utils_win.cc

Issue 1537063002: Initialize standalone embedder's copy of the monotonic clock on Windows. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years 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 | « runtime/bin/utils_macos.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/utils_win.cc
diff --git a/runtime/bin/utils_win.cc b/runtime/bin/utils_win.cc
index ae12f4b420d8d58b38a9a5927f87740f35f68e8e..116ae56157a92739d8569134c04b33b4b60756aa 100644
--- a/runtime/bin/utils_win.cc
+++ b/runtime/bin/utils_win.cc
@@ -187,12 +187,21 @@ static int64_t GetCurrentTimeMicros() {
return (time.t_ - kTimeEpoc) / kTimeScaler;
}
+static int64_t qpc_ticks_per_second = 0;
+
+void TimerUtils::InitOnce() {
+ LARGE_INTEGER ticks_per_sec;
+ if (!QueryPerformanceFrequency(&ticks_per_sec)) {
+ qpc_ticks_per_second = 0;
+ } else {
+ qpc_ticks_per_second = static_cast<int64_t>(ticks_per_sec.QuadPart);
+ }
+}
+
int64_t TimerUtils::GetCurrentMonotonicMillis() {
return GetCurrentMonotonicMicros() / 1000;
}
-static int64_t qpc_ticks_per_second = 0;
-
int64_t TimerUtils::GetCurrentMonotonicMicros() {
if (qpc_ticks_per_second == 0) {
// QueryPerformanceCounter not supported, fallback.
« no previous file with comments | « runtime/bin/utils_macos.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698