mirror of
https://github.com/gabime/spdlog.git
synced 2024-11-15 16:35:45 +08:00
Check rv of localtime_r
This commit is contained in:
parent
ce3922cff1
commit
91bf60a316
@ -84,14 +84,14 @@ spdlog::log_clock::time_point now() noexcept {
|
||||
#endif
|
||||
}
|
||||
std::tm localtime(const std::time_t &time_tt) noexcept {
|
||||
std::tm* rv;
|
||||
std::tm tm;
|
||||
#ifdef _WIN32
|
||||
std::tm tm;
|
||||
::localtime_s(&tm, &time_tt);
|
||||
rv = ::localtime_s(&tm, &time_tt);
|
||||
#else
|
||||
std::tm tm;
|
||||
::localtime_r(&time_tt, &tm);
|
||||
rv = ::localtime_r(&time_tt, &tm);
|
||||
#endif
|
||||
return tm;
|
||||
return rv != nullptr ? tm : std::tm{};
|
||||
}
|
||||
|
||||
std::tm localtime() noexcept {
|
||||
|
Loading…
Reference in New Issue
Block a user