utils: avoid fmt:gmtime/fmt::localtime

They've been deprecated and give build warnings with new enough libfmt.
This commit is contained in:
Dirk-Jan C. Binnema
2025-09-28 18:52:56 +03:00
committed by Seth Ladygo
parent 79c903d557
commit 056540b8e8

View File

@ -145,7 +145,9 @@ auto mu_join(Range&& range, std::string_view sepa) {
template <typename T=::time_t> template <typename T=::time_t>
std::tm mu_time(T t={}, bool use_utc=false) { std::tm mu_time(T t={}, bool use_utc=false) {
::time_t tt{static_cast<::time_t>(t)}; ::time_t tt{static_cast<::time_t>(t)};
return use_utc ? fmt::gmtime(tt) : fmt::localtime(tt); std::tm time_tm = {};
use_utc ? gmtime_r(&tt, &time_tm) : localtime_r(&tt, &time_tm);
return time_tm;
} }
using StringVec = std::vector<std::string>; using StringVec = std::vector<std::string>;