mpd/src/TimePrint.cxx

25 lines
455 B
C++
Raw Normal View History

// SPDX-License-Identifier: GPL-2.0-or-later
// Copyright The Music Player Daemon Project
2013-01-02 20:29:24 +01:00
#include "TimePrint.hxx"
#include "client/Response.hxx"
2019-05-08 15:47:58 +02:00
#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)
{
2018-07-25 08:29:34 +02:00
StringBuffer<64> s;
2018-07-25 08:29:55 +02:00
try {
2018-07-25 08:29:34 +02:00
s = FormatISO8601(t);
2018-07-25 08:29:55 +02:00
} catch (...) {
return;
2018-07-25 08:29:55 +02:00
}
r.Fmt(FMT_STRING("{}: {}\n"), name, s);
}