This commit is contained in:
Scott E. Graves 2023-12-14 09:00:21 -06:00
parent 3fe5eac56d
commit e959a9e795

View File

@ -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));