diff options
| author | Joshua Vandaƫle <joshua@vandaele.software> | 2025-06-04 13:12:50 +0200 |
|---|---|---|
| committer | Joshua Vandaƫle <joshua@vandaele.software> | 2025-06-04 13:32:12 +0200 |
| commit | 4b65cc9a4c51af4308f748b3e7bf25d80db83860 (patch) | |
| tree | 7b9ee319df7091ab78810add0b573f69d2b9ac29 /Source/Core/Common/TimeUtil.cpp | |
| parent | 1c9389a1fbfb24e6ea9370c3aa36c61ca528d792 (diff) | |
fmt: Replace deprecated `fmt::localtime` usage with `Common::LocalTime`
Diffstat (limited to 'Source/Core/Common/TimeUtil.cpp')
| -rw-r--r-- | Source/Core/Common/TimeUtil.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/Source/Core/Common/TimeUtil.cpp b/Source/Core/Common/TimeUtil.cpp index 39d989fb3f..93327e9136 100644 --- a/Source/Core/Common/TimeUtil.cpp +++ b/Source/Core/Common/TimeUtil.cpp @@ -2,23 +2,25 @@ // SPDX-License-Identifier: GPL-2.0-or-later #include "Common/TimeUtil.h" +#include "Common/Logging/Log.h" #include <ctime> #include <optional> namespace Common { -std::optional<std::tm> Localtime(std::time_t time) +std::optional<std::tm> LocalTime(std::time_t time) { std::tm local_time; #ifdef _MSC_VER if (localtime_s(&local_time, &time) != 0) - return std::nullopt; #else - std::tm* result = localtime_r(&time, &local_time); - if (result != &local_time) - return std::nullopt; + if (localtime_r(&time, &local_time) == NULL) #endif + { + ERROR_LOG_FMT(COMMON, "Failed to convert time to local time: {}", std::strerror(errno)); + return std::nullopt; + } return local_time; } } // Namespace Common |
