From 4b65cc9a4c51af4308f748b3e7bf25d80db83860 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joshua=20Vanda=C3=ABle?= Date: Wed, 4 Jun 2025 13:12:50 +0200 Subject: fmt: Replace deprecated `fmt::localtime` usage with `Common::LocalTime` --- Source/Core/Common/TimeUtil.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'Source/Core/Common/TimeUtil.cpp') 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 #include namespace Common { -std::optional Localtime(std::time_t time) +std::optional 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 -- cgit v1.2.3