Skip to content

Commit b46d73b

Browse files
committed
8255239: The timezone of the hs_err_pid log file is corrupted in Japanese locale
Reviewed-by: iklam, minqi
1 parent 6606e09 commit b46d73b

File tree

1 file changed

+8
-2
lines changed
  • src/hotspot/share/runtime

1 file changed

+8
-2
lines changed

src/hotspot/share/runtime/os.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1002,8 +1002,14 @@ void os::print_date_and_time(outputStream *st, char* buf, size_t buflen) {
10021002

10031003
struct tm tz;
10041004
if (localtime_pd(&tloc, &tz) != NULL) {
1005-
::strftime(buf, buflen, "%Z", &tz);
1006-
st->print("Time: %s %s", timestring, buf);
1005+
wchar_t w_buf[80];
1006+
size_t n = ::wcsftime(w_buf, 80, L"%Z", &tz);
1007+
if (n > 0) {
1008+
::wcstombs(buf, w_buf, buflen);
1009+
st->print("Time: %s %s", timestring, buf);
1010+
} else {
1011+
st->print("Time: %s", timestring);
1012+
}
10071013
} else {
10081014
st->print("Time: %s", timestring);
10091015
}

0 commit comments

Comments
 (0)