From 8e28481cba26d5043ce64685893525dceebbffaf Mon Sep 17 00:00:00 2001 From: Henri Gasc Date: Fri, 9 May 2025 18:22:55 +0200 Subject: [PATCH 1/2] Update libfmt to 11.2.0 --- external/fmt | 2 +- lib/source/pl/lib/std/time.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/external/fmt b/external/fmt index 12391371..40626af8 160000 --- a/external/fmt +++ b/external/fmt @@ -1 +1 @@ -Subproject commit 123913715afeb8a437e6388b4473fcc4753e1c9a +Subproject commit 40626af88bd7df9a5fb80be7b25ac85b122d6c21 diff --git a/lib/source/pl/lib/std/time.cpp b/lib/source/pl/lib/std/time.cpp index 96c91f61..0239ab38 100644 --- a/lib/source/pl/lib/std/time.cpp +++ b/lib/source/pl/lib/std/time.cpp @@ -57,7 +57,7 @@ namespace pl::lib::libstd::time { auto time = time_t(params[0].toUnsigned()); try { - auto localTime = fmt::localtime(time); + auto localTime = std::localtime(time); return { packTMValue(localTime) }; } catch (const fmt::format_error&) { From 7fa46d6820afe219dde83122ec66db3f97262bb9 Mon Sep 17 00:00:00 2001 From: Nik Date: Fri, 9 May 2025 18:40:01 +0200 Subject: [PATCH 2/2] Fix calling of std::localtime and replace fmt::gmtime with std::gmtime as well --- lib/source/pl/lib/std/time.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/source/pl/lib/std/time.cpp b/lib/source/pl/lib/std/time.cpp index 0239ab38..0809f099 100644 --- a/lib/source/pl/lib/std/time.cpp +++ b/lib/source/pl/lib/std/time.cpp @@ -11,7 +11,7 @@ namespace pl::lib::libstd::time { - static u128 packTMValue(std::tm tm) { + static u128 packTMValue(const std::tm &tm) { return (u128(tm.tm_sec) << 0) | (u128(tm.tm_min) << 8) | @@ -57,9 +57,9 @@ namespace pl::lib::libstd::time { auto time = time_t(params[0].toUnsigned()); try { - auto localTime = std::localtime(time); + auto localTime = std::localtime(&time); - return { packTMValue(localTime) }; + return { packTMValue(*localTime) }; } catch (const fmt::format_error&) { return u128(0); } @@ -70,9 +70,9 @@ namespace pl::lib::libstd::time { auto time = time_t(params[0].toUnsigned()); try { - auto gmTime = fmt::gmtime(time); + auto gmTime = std::gmtime(&time); - return { packTMValue(gmTime) }; + return { packTMValue(*gmTime) }; } catch (const fmt::format_error&) { return u128(0); }