diff options
| author | Stefan Boberg <[email protected]> | 2023-10-02 16:41:42 +0200 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-10-02 16:41:42 +0200 |
| commit | a8dbfa125315790da679a743901a252af7af2fa6 (patch) | |
| tree | b7d589ee7b8c569c1f4f5027d45298dbd51143ab /src | |
| parent | fix formatting of gc start message (diff) | |
| download | zen-a8dbfa125315790da679a743901a252af7af2fa6.tar.xz zen-a8dbfa125315790da679a743901a252af7af2fa6.zip | |
clean up date formatting (#440)
* clean up date formatting (previous code would include a newline)
Diffstat (limited to 'src')
| -rw-r--r-- | src/zenstore/gc.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/zenstore/gc.cpp b/src/zenstore/gc.cpp index 17d5e740c..03f0e2ae9 100644 --- a/src/zenstore/gc.cpp +++ b/src/zenstore/gc.cpp @@ -45,10 +45,10 @@ struct fmt::formatter<zen::GcClock::TimePoint> : formatter<string_view> template<typename FormatContext> auto format(const zen::GcClock::TimePoint& TimePoint, FormatContext& ctx) { - std::time_t Time = std::chrono::system_clock::to_time_t(TimePoint); - zen::ExtendableStringBuilder<32> String; - String << std::ctime(&Time); - return formatter<string_view>::format(String.ToView(), ctx); + std::time_t Time = std::chrono::system_clock::to_time_t(TimePoint); + char TimeString[std::size("yyyy-mm-ddThh:mm:ss")]; + std::strftime(std::data(TimeString), std::size(TimeString), "%FT%T", std::localtime(&Time)); + return fmt::format_to(ctx.out(), "{}", TimeString); } }; |