From c0b0023b64c03cb82afe9e023d98944d8ff09438 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Tue, 23 Jan 2024 14:38:35 -0500 Subject: [PATCH] Movie: Use re-entrant variant of gmtime in GetRTCDisplay() Makes this member function thread-safe. --- Source/Core/Core/Movie.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Source/Core/Core/Movie.cpp b/Source/Core/Core/Movie.cpp index 84b6ddc9f6..4640a3eb69 100644 --- a/Source/Core/Core/Movie.cpp +++ b/Source/Core/Core/Movie.cpp @@ -7,8 +7,8 @@ #include #include #include -#include #include +#include #include #include #include @@ -18,6 +18,7 @@ #include #include +#include #include #include "Common/Assert.h" @@ -166,11 +167,10 @@ std::string MovieManager::GetRTCDisplay() const time_t current_time = CEXIIPL::GetEmulatedTime(Core::System::GetInstance(), CEXIIPL::UNIX_EPOCH); - const tm* const gm_time = gmtime(¤t_time); + const tm gm_time = fmt::gmtime(current_time); - std::ostringstream format_time; - format_time << std::put_time(gm_time, "Date/Time: %c\n"); - return format_time.str(); + // Use current locale for formatting time, as fmt is locale-agnostic by default. + return fmt::format(std::locale{""}, "Date/Time: {:%c}", gm_time); } // NOTE: GPU Thread