Resynchronize timers if the Windows system time was changed.
authorulan@chromium.org <ulan@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Tue, 27 Mar 2012 12:34:32 +0000 (12:34 +0000)
committerulan@chromium.org <ulan@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Tue, 27 Mar 2012 12:34:32 +0000 (12:34 +0000)
R=jkummerow@chromium.org
BUG=119815
TEST=Change the system time one day back: (new Date()) will return incorrect time.

Review URL: https://chromiumcodereview.appspot.com/9865021

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@11165 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

src/platform-win32.cc

index 02c25bc..12cd610 100644 (file)
@@ -462,6 +462,9 @@ void Time::SetToCurrentTime() {
   // Check if we need to resync due to elapsed time.
   needs_resync |= (time_now.t_ - init_time.t_) > kMaxClockElapsedTime;
 
+  // Check if we need to resync due to backwards time change.
+  needs_resync |= time_now.t_ < init_time.t_;
+
   // Resync the clock if necessary.
   if (needs_resync) {
     GetSystemTimeAsFileTime(&init_time.ft_);