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 | |
| 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)
| -rw-r--r-- | CHANGELOG.md | 1 | ||||
| -rw-r--r-- | src/zenstore/gc.cpp | 8 |
2 files changed, 5 insertions, 4 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index b9d9559fa..f7246c005 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ - Improvement: Make an explicit flush of the active block written to in blockstore flush - Improvement: Make sure cache and cas MakeIndexSnapshot does not throw exception on failure which would cause and abnormal termniation at exit - Improvement: http.sys I/O completion handler no longer holds transaction lock while enqueueing new requests. This eliminates some lock contention and improves latency/throughput for certain types of requests +- Improvement: date logging in GC no longer emits extraneous newlines ## 0.2.25 - Feature: Add detailed stats on requests and data sizes on a per-bucket level, use parameter `cachestorestats=true` on the `/stats/z$` endpoint to enable 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); } }; |