changeset 49221:a04a9bee2431

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 44122f767467
children 092dc3d38bdc
files src/hotspot/share/runtime/os.cpp
diffstat 1 files changed, 13 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- 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