summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDirk-Jan C. Binnema <djcb@djcbsoftware.nl>2025-09-28 18:52:56 +0300
committerDirk-Jan C. Binnema <djcb@djcbsoftware.nl>2025-09-28 18:56:01 +0300
commit0a4fabbf446d15b538600dfe7d879cad70ce941e (patch)
treef4ba2aaaae9990311f077861b2ebac9fb74e6391
parent3ef79a70f30a573112788a5c982c77f8a76356db (diff)
utils: avoid fmt:gmtime/fmt::localtime
They've been deprecated and give build warnings with new enough libfmt.
-rw-r--r--lib/utils/mu-utils.hh4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/utils/mu-utils.hh b/lib/utils/mu-utils.hh
index ecdc2f2..32bb0dd 100644
--- a/lib/utils/mu-utils.hh
+++ b/lib/utils/mu-utils.hh
@@ -145,7 +145,9 @@ auto mu_join(Range&& range, std::string_view sepa) {
template <typename T=::time_t>
std::tm mu_time(T t={}, bool use_utc=false) {
::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>;