src/hotspot/share/runtime/os.cpp
changeset 49042 a04a9bee2431
parent 49034 57d0c33ad636
child 49177 eebf559c9e0d
--- a/src/hotspot/share/runtime/os.cpp	Thu Feb 22 10:39:42 2018 +0100
+++ b/src/hotspot/share/runtime/os.cpp	Thu Feb 22 12:05:17 2018 -0500
@@ -93,6 +93,18 @@
   os::init_globals();
 }
 
+static time_t get_timezone(const struct tm* time_struct) {
+#if defined(_ALLBSD_SOURCE)
+  return time_struct->tm_gmtoff;
+#elif defined(_WINDOWS)
+  long zone;
+  _get_timezone(&zone);
+  return static_cast<time_t>(zone);
+#else
+  return timezone;
+#endif
+}
+
 // Fill in buffer with current local time as an ISO-8601 string.
 // E.g., yyyy-mm-ddThh:mm:ss-zzzz.
 // Returns buffer, or NULL if it failed.
@@ -137,11 +149,7 @@
       return NULL;
     }
   }
-#if defined(_ALLBSD_SOURCE)
-  const time_t zone = (time_t) time_struct.tm_gmtoff;
-#else
-  const time_t zone = timezone;
-#endif
+  const time_t zone = get_timezone(&time_struct);
 
   // If daylight savings time is in effect,
   // we are 1 hour East of our time zone