1 Star 0 Fork 81

zhaosai/openjdk-1.8.0

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
Fix-localtime_r-not-defined-on-windows.patch 1.92 KB
一键复制 编辑 原始数据 按行查看 历史
crash888 提交于 2023-05-06 10:57 . #I70J8T:upgrade to jdk8u372-ga
From 2b0e2ff142de992d943a0df1aca605283f3449ab Mon Sep 17 00:00:00 2001
From: z30010524 <zhangyunbo7@huawei.com>
Date: Thu, 16 Mar 2023 11:06:12 +0800
Subject: [PATCH 09/15] Fix localtime_r() not defined on windows
DTS/AR: DTS2023031516597
Summary: <JDK> :Fix localtime_r() not defined on windows, get system time by os::localtime_pd()
LLT: NA
Patch Type: huawei
Bug url: NA
---
hotspot/src/share/vm/services/memReporter.cpp | 2 +-
hotspot/src/share/vm/services/nmtDCmd.cpp | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/hotspot/src/share/vm/services/memReporter.cpp b/hotspot/src/share/vm/services/memReporter.cpp
index 8ea363805..9fc309c74 100644
--- a/hotspot/src/share/vm/services/memReporter.cpp
+++ b/hotspot/src/share/vm/services/memReporter.cpp
@@ -298,7 +298,7 @@ void MemSummaryDiffReporter::report_diff() {
time_t startTime = NMTDCmd::get_start_time();
time_t endTime = time(0);
struct tm endTimeTm = {0};
- if (localtime_r(&endTime, &endTimeTm) == NULL) {
+ if (os::localtime_pd(&endTime, &endTimeTm) == NULL) {
out->print_cr("\nNative Memory Tracking:\n");
} else {
out->print_cr("\nNative Memory Tracking: end time is %d-%02d-%02d %02d:%02d:%02d, elapsed time is %d secs\n",
diff --git a/hotspot/src/share/vm/services/nmtDCmd.cpp b/hotspot/src/share/vm/services/nmtDCmd.cpp
index 417a58c59..5f6842a99 100644
--- a/hotspot/src/share/vm/services/nmtDCmd.cpp
+++ b/hotspot/src/share/vm/services/nmtDCmd.cpp
@@ -132,7 +132,7 @@ void NMTDCmd::execute(DCmdSource source, TRAPS) {
NMTDCmd::set_start_time(time(0));
time_t startTime = NMTDCmd::get_start_time();
struct tm startTimeTm = {0};
- if (localtime_r(&startTime, &startTimeTm) == NULL) {
+ if (os::localtime_pd(&startTime, &startTimeTm) == NULL) {
output()->print_cr("Baseline succeeded");
} else {
output()->print_cr("Baseline succeeded, start time is %d-%02d-%02d %02d:%02d:%02d",
--
2.19.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/zhaosai-Simon/openjdk-1.8.0.git
git@gitee.com:zhaosai-Simon/openjdk-1.8.0.git
zhaosai-Simon
openjdk-1.8.0
openjdk-1.8.0
master

搜索帮助