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

Unified Diff: runtime/bin/utils_win.cc

Issue 1519073003: Also copy the fallback code. (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 | « no previous file | 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 8a114ceecf7d815a7bc71b2b4ce9931d9b56d545..ae12f4b420d8d58b38a9a5927f87740f35f68e8e 100644
--- a/runtime/bin/utils_win.cc
+++ b/runtime/bin/utils_win.cc
@@ -168,6 +168,25 @@ bool ShellUtils::GetUtf8Argv(int argc, char** argv) {
return true;
}
+static int64_t GetCurrentTimeMicros() {
+ static const int64_t kTimeEpoc = 116444736000000000LL;
+ static const int64_t kTimeScaler = 10; // 100 ns to us.
+
+ // Although win32 uses 64-bit integers for representing timestamps,
+ // these are packed into a FILETIME structure. The FILETIME
+ // structure is just a struct representing a 64-bit integer. The
+ // TimeStamp union allows access to both a FILETIME and an integer
+ // representation of the timestamp. The Windows timestamp is in
+ // 100-nanosecond intervals since January 1, 1601.
+ union TimeStamp {
+ FILETIME ft_;
+ int64_t t_;
+ };
+ TimeStamp time;
+ GetSystemTimeAsFileTime(&time.ft_);
+ return (time.t_ - kTimeEpoc) / kTimeScaler;
+}
+
int64_t TimerUtils::GetCurrentMonotonicMillis() {
return GetCurrentMonotonicMicros() / 1000;
}
« 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