From 7ceaa32e9648c36e82361bfba9a80625596a207d Mon Sep 17 00:00:00 2001 From: Vladimir Petko Date: Wed, 19 Jun 2024 14:27:16 +1200 Subject: [PATCH 1/2] use int instead of time_t to print timezone info --- src/hotspot/share/runtime/os.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/hotspot/share/runtime/os.cpp b/src/hotspot/share/runtime/os.cpp index bdf93e1d3b403..d928dc55dced4 100644 --- a/src/hotspot/share/runtime/os.cpp +++ b/src/hotspot/share/runtime/os.cpp @@ -209,8 +209,8 @@ char* os::iso8601_time(jlong milliseconds_since_19700101, char* buffer, size_t b abs_local_to_UTC = -(abs_local_to_UTC); } // Convert time zone offset seconds to hours and minutes. - const time_t zone_hours = (abs_local_to_UTC / seconds_per_hour); - const time_t zone_min = + const int zone_hours = (abs_local_to_UTC / seconds_per_hour); + const int zone_min = ((abs_local_to_UTC % seconds_per_hour) / seconds_per_minute); // Print an ISO 8601 date and time stamp into the buffer From ff97727f9a7141451dcc9a2565d277368c4b5d99 Mon Sep 17 00:00:00 2001 From: Vladimir Petko Date: Tue, 16 Jul 2024 14:56:48 +1200 Subject: [PATCH 2/2] add static_cast to avoid -Wconversion warnings. --- src/hotspot/share/runtime/os.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/hotspot/share/runtime/os.cpp b/src/hotspot/share/runtime/os.cpp index 58af469627be9..c1d0c9d2fb495 100644 --- a/src/hotspot/share/runtime/os.cpp +++ b/src/hotspot/share/runtime/os.cpp @@ -213,9 +213,9 @@ char* os::iso8601_time(jlong milliseconds_since_19700101, char* buffer, size_t b abs_local_to_UTC = -(abs_local_to_UTC); } // Convert time zone offset seconds to hours and minutes. - const int zone_hours = (abs_local_to_UTC / seconds_per_hour); + const int zone_hours = static_cast(abs_local_to_UTC / seconds_per_hour); const int zone_min = - ((abs_local_to_UTC % seconds_per_hour) / seconds_per_minute); + static_cast((abs_local_to_UTC % seconds_per_hour) / seconds_per_minute); // Print an ISO 8601 date and time stamp into the buffer const int year = 1900 + time_struct.tm_year;