Fix localtime_s()usage

This commit is contained in:
Gabi Melman 2024-01-13 20:20:58 +02:00 committed by GitHub
parent aaebfbb5c6
commit 6c799d04f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -86,12 +86,13 @@ spdlog::log_clock::time_point now() noexcept {
std::tm localtime(const std::time_t &time_tt) noexcept {
#ifdef _WIN32
std::tm tm;
const auto *rv = ::localtime_s(&tm, &time_tt);
const auto rv = ::localtime_s(&tm, &time_tt);
return rv == 0 ? tm : std::tm{};
#else
std::tm tm;
const auto *rv = ::localtime_r(&time_tt, &tm);
#endif
return rv != nullptr ? tm : std::tm{};
#endif
}
std::tm localtime() noexcept {