mpd/src/TimePrint.cxx
Max Kellermann a8042885ac TimePrint: minor fixup for libfmt 10
libfmt version 10 has difficulties formatting a `StringBuffer`, and we
need to help it by explicitly invoking the `c_str()` method.
2023-05-21 20:58:19 +02:00

25 lines
463 B
C++

// SPDX-License-Identifier: GPL-2.0-or-later
// Copyright The Music Player Daemon Project
#include "TimePrint.hxx"
#include "client/Response.hxx"
#include "time/ISO8601.hxx"
#include "util/StringBuffer.hxx"
#include <fmt/format.h>
void
time_print(Response &r, const char *name,
std::chrono::system_clock::time_point t)
{
StringBuffer<64> s;
try {
s = FormatISO8601(t);
} catch (...) {
return;
}
r.Fmt(FMT_STRING("{}: {}\n"), name, s.c_str());
}