fix
This commit is contained in:
parent
3fe5eac56d
commit
e959a9e795
@ -226,14 +226,14 @@ auto get_file_time_now() -> std::uint64_t {
|
|||||||
void get_local_time_now(struct tm &local_time) {
|
void get_local_time_now(struct tm &local_time) {
|
||||||
memset(&local_time, 0, sizeof(local_time));
|
memset(&local_time, 0, sizeof(local_time));
|
||||||
|
|
||||||
|
static std::mutex mtx{};
|
||||||
|
mutex_lock lock{mtx};
|
||||||
|
|
||||||
const auto now =
|
const auto now =
|
||||||
std::chrono::system_clock::to_time_t(std::chrono::system_clock::now());
|
std::chrono::system_clock::to_time_t(std::chrono::system_clock::now());
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
localtime_s(&local_time, &now);
|
localtime_s(&local_time, &now);
|
||||||
#else
|
#else
|
||||||
static std::mutex mtx{};
|
|
||||||
mutex_lock lock{mtx};
|
|
||||||
|
|
||||||
const auto *tmp = std::localtime(&now);
|
const auto *tmp = std::localtime(&now);
|
||||||
if (tmp != nullptr) {
|
if (tmp != nullptr) {
|
||||||
memcpy(&local_time, tmp, sizeof(local_time));
|
memcpy(&local_time, tmp, sizeof(local_time));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user