diff options
author | Klaus Aehlig <klaus.aehlig@huawei.com> | 2025-02-06 12:08:35 +0100 |
---|---|---|
committer | Klaus Aehlig <klaus.aehlig@huawei.com> | 2025-02-06 12:30:28 +0100 |
commit | 7f0fa6f93da3f041d842e369ba2ea5c90aa8523b (patch) | |
tree | 9df86bbc5299a52b59769b632273d882a5d189b7 /src | |
parent | 94e8bb0af2141069617e982d03162c0b52a3a90f (diff) | |
download | justbuild-7f0fa6f93da3f041d842e369ba2ea5c90aa8523b.tar.gz |
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).
Diffstat (limited to 'src')
-rw-r--r-- | src/buildtool/logging/log_sink_file.hpp | 4 |
1 files changed, 2 insertions, 2 deletions
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{}; |