From 2dcdbae4dde4d7983496a6858e5d35a8053b2112 Mon Sep 17 00:00:00 2001 From: lzwind Date: Tue, 14 Jul 2026 21:05:01 +0800 Subject: [PATCH] timedatectl: display RTCTimeUSec in UTC format Fixes #39930 The RTCTimeUSec property was being displayed in local time format when using 'timedatectl show', while 'timedatectl status' correctly displayed it in UTC format. This inconsistency was due to the bus_print_all_properties() function using TIMESTAMP_PRETTY style for all timestamps, which formats in local time. This fix adds special handling for RTCTimeUSec to use TIMESTAMP_UTC style, ensuring consistent UTC display across both commands. --- src/shared/bus-print-properties.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/shared/bus-print-properties.c b/src/shared/bus-print-properties.c index 431b33c100c..d2377ceb60b 100644 --- a/src/shared/bus-print-properties.c +++ b/src/shared/bus-print-properties.c @@ -113,7 +113,11 @@ static int bus_print_property(const char *name, const char *expected_value, sd_b return r; if (bus_property_is_timestamp(name)) - bus_print_property_value(name, expected_value, flags, FORMAT_TIMESTAMP(u)); + /* RTCTimeUSec should always be displayed in UTC, consistent with timedatectl status */ + if (streq(name, "RTCTimeUSec")) + bus_print_property_value(name, expected_value, flags, FORMAT_TIMESTAMP_STYLE(u, TIMESTAMP_UTC)); + else + bus_print_property_value(name, expected_value, flags, FORMAT_TIMESTAMP(u)); /* Managed OOM pressure default implies "unset" and use the default set in oomd.conf. Without * this condition, we will print "infinity" which implies there is no limit on memory