提交 9ea82c1d 编写于 作者: L lfoltan

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
上级 277c9802
......@@ -96,6 +96,18 @@ void os_init_globals() {
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 @@ char* os::iso8601_time(char* buffer, size_t buffer_length) {
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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册