< prev index next >

src/hotspot/share/runtime/os.cpp

Print this page

        

*** 86,107 **** static size_t cur_malloc_words = 0; // current size for MallocMaxTestWords DEBUG_ONLY(bool os::_mutex_init_done = false;) - 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 - } - int os::snprintf(char* buf, size_t len, const char* fmt, ...) { va_list args; va_start(args, fmt); int result = os::vsnprintf(buf, len, fmt, args); va_end(args); --- 86,95 ----
*** 150,174 **** if (localtime_pd(&seconds_since_19700101, &time_struct) == NULL) { assert(false, "Failed localtime_pd"); return NULL; } } - const time_t zone = get_timezone(&time_struct); - // If daylight savings time is in effect, - // we are 1 hour East of our time zone const time_t seconds_per_minute = 60; const time_t minutes_per_hour = 60; const time_t seconds_per_hour = seconds_per_minute * minutes_per_hour; - time_t UTC_to_local = zone; - if (time_struct.tm_isdst > 0) { - UTC_to_local = UTC_to_local - seconds_per_hour; - } // No offset when dealing with UTC ! if (utc) { ! UTC_to_local = 0; } // Compute the time zone offset. // localtime_pd() sets timezone to the difference (in seconds) // between UTC and and local time. --- 138,173 ---- if (localtime_pd(&seconds_since_19700101, &time_struct) == NULL) { assert(false, "Failed localtime_pd"); return NULL; } } const time_t seconds_per_minute = 60; const time_t minutes_per_hour = 60; const time_t seconds_per_hour = seconds_per_minute * minutes_per_hour; // No offset when dealing with UTC ! time_t UTC_to_local = 0; ! if (!utc) { ! #if defined(_ALLBSD_SOURCE) ! UTC_to_local = time_struct.tm_gmtoff; ! #elif defined(_WINDOWS) ! long zone; ! _get_timezone(&zone); ! UTC_to_local = static_cast<time_t>(zone); ! #else ! UTC_to_local = timezone; ! #endif ! ! // tm_gmtoff already includes adjustment for daylight saving ! #if !defined(_ALLBSD_SOURCE) ! // If daylight savings time is in effect, ! // we are 1 hour East of our time zone ! if (time_struct->tm_isdst > 0) { ! offset = offset - seconds_per_hour; ! } ! #endif } // Compute the time zone offset. // localtime_pd() sets timezone to the difference (in seconds) // between UTC and and local time.
< prev index next >