From 7f0fa6f93da3f041d842e369ba2ea5c90aa8523b Mon Sep 17 00:00:00 2001 From: Klaus Aehlig Date: Thu, 6 Feb 2025 12:08:35 +0100 Subject: logging: switch time stamps to UTC Time stamps in local time without explicit time zone are ambigious, definitely at the end of daylight saving time. Moreover, even if explicit time zones were given, it is still unconvenient to correctly sort event expressed in different time zones. However, with increased use of `just serve`, logs originating from different machines become the norm. Therefore, normalize all time stamps to UTC (and explicitly state that this is the time zone used). --- src/buildtool/logging/log_sink_file.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/buildtool/logging/log_sink_file.hpp b/src/buildtool/logging/log_sink_file.hpp index ec9ee257..1ff6ad47 100644 --- a/src/buildtool/logging/log_sink_file.hpp +++ b/src/buildtool/logging/log_sink_file.hpp @@ -102,10 +102,10 @@ class LogSinkFile final : public ILogSink { timespec ts{}; clock_gettime(CLOCK_REALTIME, &ts); auto timestamp = fmt::format( - "{:%Y-%m-%d %H:%M:%S}.{}", fmt::localtime(ts.tv_sec), ts.tv_nsec); + "{:%Y-%m-%d %H:%M:%S}.{} UTC", fmt::gmtime(ts.tv_sec), ts.tv_nsec); #else auto timestamp = fmt::format( - "{:%Y-%m-%d %H:%M:%S}", fmt::localtime(std::time(nullptr)); + "{:%Y-%m-%d %H:%M:%S} UTC", fmt::gmtime(std::time(nullptr)); #endif std::ostringstream id{}; -- cgit v1.2.3