From bcb57a1c5c81fa0769cbc47f8912c57fcff4ee32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joshua=20Vanda=C3=ABle?= Date: Wed, 25 Feb 2026 06:50:46 +0100 Subject: [PATCH] fmt: Remove unnecessary locale specifications As far as I can tell the comments are wrong, in my testing the string representation changes with the locale without using `std::locale{""}`. Moreso, using `std::locale{""}` throws `std::runtime_error` if LC_ALL points to an invalid locale, leading to a crash. --- Source/Core/Core/Movie.cpp | 3 +-- Source/Core/Core/State.cpp | 3 +-- Source/Core/VideoCommon/PostProcessing.cpp | 2 +- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/Source/Core/Core/Movie.cpp b/Source/Core/Core/Movie.cpp index deaa8088b8..90a25d8246 100644 --- a/Source/Core/Core/Movie.cpp +++ b/Source/Core/Core/Movie.cpp @@ -157,8 +157,7 @@ std::string MovieManager::GetRTCDisplay() const const time_t current_time = CEXIIPL::GetEmulatedTime(m_system, CEXIIPL::UNIX_EPOCH); const tm gm_time = fmt::gmtime(current_time); - // Use current locale for formatting time, as fmt is locale-agnostic by default. - return fmt::format(std::locale{""}, "Date/Time: {:%c}", gm_time); + return fmt::format("Date/Time: {:%c}", gm_time); } // NOTE: GPU Thread diff --git a/Source/Core/Core/State.cpp b/Source/Core/Core/State.cpp index 98180a8736..d3c4aaa0f0 100644 --- a/Source/Core/Core/State.cpp +++ b/Source/Core/Core/State.cpp @@ -297,8 +297,7 @@ static std::string SystemTimeAsDoubleToString(double time) if (!local_time) return ""; - // fmt is locale agnostic by default, so explicitly use current locale. - return fmt::format(std::locale{""}, "{:%x %X}", *local_time); + return fmt::format("{:%x %X}", *local_time); } static std::string MakeStateFilename(int number) diff --git a/Source/Core/VideoCommon/PostProcessing.cpp b/Source/Core/VideoCommon/PostProcessing.cpp index 804c24eef6..7de89b8e17 100644 --- a/Source/Core/VideoCommon/PostProcessing.cpp +++ b/Source/Core/VideoCommon/PostProcessing.cpp @@ -330,7 +330,7 @@ void PostProcessingConfiguration::SaveOptionsConfiguration() case ConfigurationOption::OptionType::Float: { std::ostringstream value; - value.imbue(std::locale("C")); + value.imbue(std::locale::classic()); for (size_t i = 0; i < it.second.m_float_values.size(); ++i) {