diff options
author | ShreyasMahangade <139431044+ShreyasMahangade@users.noreply.github.com> | 2024-07-20 19:07:30 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-07-20 19:07:30 +0200 |
commit | db708fc9ba551325e000cc12bd3490a5de0715ba (patch) | |
tree | 2a4ea732d942b39ed838f438ef67d7df36dd87de /src/timedate | |
parent | meson: fix missing failure if bpf-framework was enabled (diff) | |
download | systemd-db708fc9ba551325e000cc12bd3490a5de0715ba.tar.xz systemd-db708fc9ba551325e000cc12bd3490a5de0715ba.zip |
timedatectl: setting set_local_rtc to 1 will throw Warning as well, use log_warning() (#33489)
Previously only running `timedatectl` it was showing warning regarding the dangers of setting RTC to local TZ.
Now similar warning is also flashed when `set-local-rtc 1`.
Diffstat (limited to 'src/timedate')
-rw-r--r-- | src/timedate/timedatectl.c | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/src/timedate/timedatectl.c b/src/timedate/timedatectl.c index 2e19b28a6d..f9ca15cc81 100644 --- a/src/timedate/timedatectl.c +++ b/src/timedate/timedatectl.c @@ -149,14 +149,15 @@ static int print_status_info(const StatusInfo *i) { if (r < 0) return table_log_print_error(r); - if (i->rtc_local) - printf("\n%s" - "Warning: The system is configured to read the RTC time in the local time zone.\n" - " This mode cannot be fully supported. It will create various problems\n" - " with time zone changes and daylight saving time adjustments. The RTC\n" - " time is never updated, it relies on external facilities to maintain it.\n" - " If at all possible, use RTC in UTC by calling\n" - " 'timedatectl set-local-rtc 0'.%s\n", ansi_highlight(), ansi_normal()); + if (i->rtc_local) { + fflush(stdout); + log_warning(" \nWarning: The system is configured to read the RTC time in the local time zone.\n" + " This mode cannot be fully supported. It will create various problems\n" + " with time zone changes and daylight saving time adjustments. The RTC\n" + " time is never updated, it relies on external facilities to maintain it.\n" + " If at all possible, use RTC in UTC by calling\n" + " 'timedatectl set-local-rtc 0'.\n"); + } return 0; } @@ -261,6 +262,13 @@ static int set_local_rtc(int argc, char **argv, void *userdata) { if (b < 0) return log_error_errno(b, "Failed to parse local RTC setting '%s': %m", argv[1]); + if (b == 1) + log_warning("Warning: The system is now being configured to read the RTC time in the local time zone\n" + " This mode cannot be fully supported. It will create various problems\n" + " with time zone changes and daylight saving time adjustments. The RTC\n" + " time is never updated, it relies on external facilities to maintain it.\n" + " If at all possible, use RTC in UTC"); + r = bus_call_method( bus, bus_timedate, |