mirror of
https://github.com/gabime/spdlog.git
synced 2025-02-05 04:06:46 +08:00
Fix localtime_s()usage
This commit is contained in:
parent
aaebfbb5c6
commit
6c799d04f8
@ -86,12 +86,13 @@ spdlog::log_clock::time_point now() noexcept {
|
|||||||
std::tm localtime(const std::time_t &time_tt) noexcept {
|
std::tm localtime(const std::time_t &time_tt) noexcept {
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
std::tm tm;
|
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
|
#else
|
||||||
std::tm tm;
|
std::tm tm;
|
||||||
const auto *rv = ::localtime_r(&time_tt, &tm);
|
const auto *rv = ::localtime_r(&time_tt, &tm);
|
||||||
#endif
|
|
||||||
return rv != nullptr ? tm : std::tm{};
|
return rv != nullptr ? tm : std::tm{};
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
std::tm localtime() noexcept {
|
std::tm localtime() noexcept {
|
||||||
|
Loading…
Reference in New Issue
Block a user