From 0c2e151a779cc63740aa138a73868e4edbff40f0 Mon Sep 17 00:00:00 2001 From: PM Date: Wed, 26 Mar 2025 01:03:34 -0400 Subject: [PATCH] use data race safe gmtime variant as in NormSession::OnReportTimeout (#91) Co-authored-by: Pat Mills --- src/common/normSession.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/common/normSession.cpp b/src/common/normSession.cpp index f0dae72..6c73855 100755 --- a/src/common/normSession.cpp +++ b/src/common/normSession.cpp @@ -2628,7 +2628,14 @@ void NormTrace(const struct timeval ¤tTime, struct tm *ct = &timeStruct; #else time_t secs = (time_t)currentTime.tv_sec; - struct tm *ct = gmtime(&secs); + struct tm timeStruct; +#ifdef WIN32 + gmtime_s(&timeStruct, &secs); + struct tm *ct = &timeStruct; +#else + struct tm *ct = gmtime_r(&secs, &timeStruct); +#endif + #endif // if/else _WIN32_WCE PLOG(PL_ALWAYS, "trace>%02d:%02d:%02d.%06lu ",