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

Unified Diff: src/runtime/runtime-date.cc

Issue 1160143004: Introduce a flag to overwrite Date.now() with a fixed value (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 7 months 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 | « src/flag-definitions.h ('k') | test/mjsunit/fixed-date.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime/runtime-date.cc
diff --git a/src/runtime/runtime-date.cc b/src/runtime/runtime-date.cc
index d2b93f03684e9db5238865f7a55c4e8e85ca94e2..b53b7fa4c031e899fc65f68dcdf615bf70ef1324 100644
--- a/src/runtime/runtime-date.cc
+++ b/src/runtime/runtime-date.cc
@@ -78,7 +78,10 @@ RUNTIME_FUNCTION(Runtime_DateCurrentTime) {
// time is milliseconds. Therefore, we floor the result of getting
// the OS time.
double millis;
- if (FLAG_verify_predictable) {
+ if (FLAG_fixed_date > 0) {
+ millis = 1388534400000.0; // Jan 1 2014 00:00:00 GMT+0000
+ millis += 1000.0 * FLAG_fixed_date;
+ } else if (FLAG_verify_predictable) {
millis = 1388534400000.0; // Jan 1 2014 00:00:00 GMT+0000
millis += Floor(isolate->heap()->synthetic_time());
} else {
« no previous file with comments | « src/flag-definitions.h ('k') | test/mjsunit/fixed-date.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698