Reviewers: ulan,

Message:
Ulan - would you mind reviewing this and helping me figure out how to land it? I've manually tested that this helps recognize time zone configuration changes
on windows.

Description:
Invalidate OS-specific datetime cache on configuration change notification

When V8 is informed that the system's date time configuration has changed,
it should also drop its OS-specific caches of time zone information

[email protected]

Please review this at https://codereview.chromium.org/193873002/

SVN Base: https://chromium.googlesource.com/external/v8.git@master

Affected files (+14, -1 lines):
  M src/date.cc
  M src/platform-posix.cc
  M src/platform-win32.cc
  M src/platform.h


Index: src/date.cc
diff --git a/src/date.cc b/src/date.cc
index 4afd8dc60c4dcc444bf612e533a47c60523ad2c7..4d9cf2217681cbf8f7a39d961775aceef3fa990a 100644
--- a/src/date.cc
+++ b/src/date.cc
@@ -62,6 +62,7 @@ void DateCache::ResetDateCache() {
   after_ = &dst_[1];
   local_offset_ms_ = kInvalidLocalOffsetInMs;
   ymd_valid_ = false;
+  OS::TimeZoneChanged();
 }


Index: src/platform-posix.cc
diff --git a/src/platform-posix.cc b/src/platform-posix.cc
index c91cf241960d5a245abca3f8277c43c32e27d951..e77170c3d4a2d255af00ac63382b833f9428d702 100644
--- a/src/platform-posix.cc
+++ b/src/platform-posix.cc
@@ -363,6 +363,10 @@ double OS::DaylightSavingsOffset(double time) {
 }


+void OS::TimeZoneChanged() {
+}
+
+
 int OS::GetLastError() {
   return errno;
 }
Index: src/platform-win32.cc
diff --git a/src/platform-win32.cc b/src/platform-win32.cc
index 52c3050f3d4692bbc39374ce593019310ec237ca..f82dab8eb63f582b33871c7af04f5ec27e662b1e 100644
--- a/src/platform-win32.cc
+++ b/src/platform-win32.cc
@@ -76,7 +76,6 @@ inline void MemoryBarrier() {

 #endif  // __MINGW64_VERSION_MAJOR

-
 int localtime_s(tm* out_tm, const time_t* time) {
   tm* posix_local_time_struct = localtime(time);
   if (posix_local_time_struct == NULL) return 1;
@@ -251,6 +250,8 @@ class Win32Time {
   // timestamp taking into account daylight saving.
   char* LocalTimezone();

+  static void TimeZoneChanged() { tz_initialized_ = false; }
+
  private:
   // Constants for time conversion.
   static const int64_t kTimeEpoc = 116444736000000000LL;
@@ -611,6 +612,11 @@ double OS::DaylightSavingsOffset(double time) {
 }


+void OS::TimeZoneChanged() {
+  Win32Time::TimeZoneChanged();
+}
+
+
 int OS::GetLastError() {
   return ::GetLastError();
 }
Index: src/platform.h
diff --git a/src/platform.h b/src/platform.h
index 8af90f1cb3e9799e85986d4cb84cd6df6a295e78..d42466639e80470772038806bef25b7da05efba3 100644
--- a/src/platform.h
+++ b/src/platform.h
@@ -193,6 +193,8 @@ class OS {
   // Returns the daylight savings offset for the given time.
   static double DaylightSavingsOffset(double time);

+  static void TimeZoneChanged();
+
   // Returns last OS error.
   static int GetLastError();



--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to