From e959a9e795c3f99136d2a76fb5ebe5df7b667f3f Mon Sep 17 00:00:00 2001 From: "Scott E. Graves" Date: Thu, 14 Dec 2023 09:00:21 -0600 Subject: [PATCH] fix --- src/utils/utils.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/utils/utils.cpp b/src/utils/utils.cpp index 3b99dd69..f60629be 100644 --- a/src/utils/utils.cpp +++ b/src/utils/utils.cpp @@ -226,14 +226,14 @@ auto get_file_time_now() -> std::uint64_t { void get_local_time_now(struct tm &local_time) { memset(&local_time, 0, sizeof(local_time)); + static std::mutex mtx{}; + mutex_lock lock{mtx}; + const auto now = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now()); #ifdef _WIN32 localtime_s(&local_time, &now); #else - static std::mutex mtx{}; - mutex_lock lock{mtx}; - const auto *tmp = std::localtime(&now); if (tmp != nullptr) { memcpy(&local_time, tmp, sizeof(local_time));