changeset 8852:b5dd721bdda8

8197868: VS2017 (C2065) 'timezone': Undeclared Identifier in share/runtime/os.cpp Summary: Change to use the functional version of _get_timezone for VS2017. Reviewed-by: coleenp, hseigel Contributed-by: kim.barrett@oracle.com, lois.foltan@oracle.com
author lfoltan
date Thu, 22 Feb 2018 12:05:17 -0500
parents 6ab57fe8b51f
children c741a7bc982a
files src/share/vm/runtime/os.cpp
diffstat 1 files changed, 13 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/runtime/os.cpp	Wed Jun 13 07:02:53 2018 -0700
+++ b/src/share/vm/runtime/os.cpp	Thu Feb 22 12:05:17 2018 -0500
@@ -96,6 +96,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.
@@ -134,11 +146,7 @@
     assert(false, "Failed localtime_pd");
     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