1 /* SPDX-License-Identifier: LGPL-2.1+ */
3 Copyright 2013 Kay Sievers
14 #include "bus-error.h"
16 #include "in-addr-util.h"
18 #include "parse-util.h"
19 #include "spawn-polkit-agent.h"
20 #include "sparse-endian.h"
21 #include "string-table.h"
23 #include "terminal-util.h"
27 static bool arg_no_pager
= false;
28 static bool arg_ask_password
= true;
29 static BusTransport arg_transport
= BUS_TRANSPORT_LOCAL
;
30 static char *arg_host
= NULL
;
31 static bool arg_adjust_system_clock
= false;
32 static bool arg_monitor
= false;
33 static char **arg_property
= NULL
;
34 static bool arg_value
= false;
35 static bool arg_all
= false;
37 typedef struct StatusInfo
{
49 static void print_status_info(const StatusInfo
*i
) {
50 const char *old_tz
= NULL
, *tz
;
51 bool have_time
= false;
60 /* Save the old $TZ */
66 if (setenv("TZ", isempty(i
->timezone
) ? "UTC" : i
->timezone
, true) < 0)
67 log_warning_errno(errno
, "Failed to set TZ environment variable, ignoring: %m");
72 sec
= (time_t) (i
->time
/ USEC_PER_SEC
);
74 } else if (IN_SET(arg_transport
, BUS_TRANSPORT_LOCAL
, BUS_TRANSPORT_MACHINE
)) {
78 log_warning("Could not get time from timedated and not operating locally, ignoring.");
81 n
= strftime(a
, sizeof a
, "%a %Y-%m-%d %H:%M:%S %Z", localtime_r(&sec
, &tm
));
82 printf(" Local time: %s\n", n
> 0 ? a
: "n/a");
84 n
= strftime(a
, sizeof a
, "%a %Y-%m-%d %H:%M:%S UTC", gmtime_r(&sec
, &tm
));
85 printf(" Universal time: %s\n", n
> 0 ? a
: "n/a");
87 printf(" Local time: %s\n", "n/a");
88 printf(" Universal time: %s\n", "n/a");
91 if (i
->rtc_time
> 0) {
94 rtc_sec
= (time_t) (i
->rtc_time
/ USEC_PER_SEC
);
95 n
= strftime(a
, sizeof a
, "%a %Y-%m-%d %H:%M:%S", gmtime_r(&rtc_sec
, &tm
));
96 printf(" RTC time: %s\n", n
> 0 ? a
: "n/a");
98 printf(" RTC time: %s\n", "n/a");
101 n
= strftime(a
, sizeof a
, "%Z, %z", localtime_r(&sec
, &tm
));
103 /* Restore the $TZ */
105 r
= setenv("TZ", old_tz
, true);
109 log_warning_errno(errno
, "Failed to set TZ environment variable, ignoring: %m");
113 printf(" Time zone: %s (%s)\n"
114 "System clock synchronized: %s\n"
116 " RTC in local TZ: %s\n",
117 strna(i
->timezone
), have_time
&& n
> 0 ? a
: "n/a",
118 yes_no(i
->ntp_synced
),
119 i
->ntp_capable
? (i
->ntp_active
? "active" : "inactive") : "n/a",
120 yes_no(i
->rtc_local
));
124 "Warning: The system is configured to read the RTC time in the local time zone.\n"
125 " This mode cannot be fully supported. It will create various problems\n"
126 " with time zone changes and daylight saving time adjustments. The RTC\n"
127 " time is never updated, it relies on external facilities to maintain it.\n"
128 " If at all possible, use RTC in UTC by calling\n"
129 " 'timedatectl set-local-rtc 0'.%s\n", ansi_highlight(), ansi_normal());
132 static int show_status(int argc
, char **argv
, void *userdata
) {
133 StatusInfo info
= {};
134 static const struct bus_properties_map map
[] = {
135 { "Timezone", "s", NULL
, offsetof(StatusInfo
, timezone
) },
136 { "LocalRTC", "b", NULL
, offsetof(StatusInfo
, rtc_local
) },
137 { "NTP", "b", NULL
, offsetof(StatusInfo
, ntp_active
) },
138 { "CanNTP", "b", NULL
, offsetof(StatusInfo
, ntp_capable
) },
139 { "NTPSynchronized", "b", NULL
, offsetof(StatusInfo
, ntp_synced
) },
140 { "TimeUSec", "t", NULL
, offsetof(StatusInfo
, time
) },
141 { "RTCTimeUSec", "t", NULL
, offsetof(StatusInfo
, rtc_time
) },
145 _cleanup_(sd_bus_error_free
) sd_bus_error error
= SD_BUS_ERROR_NULL
;
146 _cleanup_(sd_bus_message_unrefp
) sd_bus_message
*m
= NULL
;
147 sd_bus
*bus
= userdata
;
152 r
= bus_map_all_properties(bus
,
153 "org.freedesktop.timedate1",
154 "/org/freedesktop/timedate1",
156 BUS_MAP_BOOLEAN_AS_BOOL
,
161 return log_error_errno(r
, "Failed to query server: %s", bus_error_message(&error
, r
));
163 print_status_info(&info
);
168 static int show_properties(int argc
, char **argv
, void *userdata
) {
169 sd_bus
*bus
= userdata
;
174 r
= bus_print_all_properties(bus
,
175 "org.freedesktop.timedate1",
176 "/org/freedesktop/timedate1",
183 return bus_log_parse_error(r
);
188 static int set_time(int argc
, char **argv
, void *userdata
) {
189 _cleanup_(sd_bus_error_free
) sd_bus_error error
= SD_BUS_ERROR_NULL
;
190 bool relative
= false, interactive
= arg_ask_password
;
191 sd_bus
*bus
= userdata
;
195 polkit_agent_open_if_enabled(arg_transport
, arg_ask_password
);
197 r
= parse_timestamp(argv
[1], &t
);
199 return log_error_errno(r
, "Failed to parse time specification '%s': %m", argv
[1]);
201 r
= sd_bus_call_method(bus
,
202 "org.freedesktop.timedate1",
203 "/org/freedesktop/timedate1",
204 "org.freedesktop.timedate1",
208 "xbb", (int64_t) t
, relative
, interactive
);
210 log_error("Failed to set time: %s", bus_error_message(&error
, r
));
215 static int set_timezone(int argc
, char **argv
, void *userdata
) {
216 _cleanup_(sd_bus_error_free
) sd_bus_error error
= SD_BUS_ERROR_NULL
;
217 sd_bus
*bus
= userdata
;
220 polkit_agent_open_if_enabled(arg_transport
, arg_ask_password
);
222 r
= sd_bus_call_method(bus
,
223 "org.freedesktop.timedate1",
224 "/org/freedesktop/timedate1",
225 "org.freedesktop.timedate1",
229 "sb", argv
[1], arg_ask_password
);
231 log_error("Failed to set time zone: %s", bus_error_message(&error
, r
));
236 static int set_local_rtc(int argc
, char **argv
, void *userdata
) {
237 _cleanup_(sd_bus_error_free
) sd_bus_error error
= SD_BUS_ERROR_NULL
;
238 sd_bus
*bus
= userdata
;
241 polkit_agent_open_if_enabled(arg_transport
, arg_ask_password
);
243 b
= parse_boolean(argv
[1]);
245 return log_error_errno(b
, "Failed to parse local RTC setting '%s': %m", argv
[1]);
247 r
= sd_bus_call_method(bus
,
248 "org.freedesktop.timedate1",
249 "/org/freedesktop/timedate1",
250 "org.freedesktop.timedate1",
254 "bbb", b
, arg_adjust_system_clock
, arg_ask_password
);
256 log_error("Failed to set local RTC: %s", bus_error_message(&error
, r
));
261 static int set_ntp(int argc
, char **argv
, void *userdata
) {
262 _cleanup_(sd_bus_error_free
) sd_bus_error error
= SD_BUS_ERROR_NULL
;
263 sd_bus
*bus
= userdata
;
266 polkit_agent_open_if_enabled(arg_transport
, arg_ask_password
);
268 b
= parse_boolean(argv
[1]);
270 return log_error_errno(b
, "Failed to parse NTP setting '%s': %m", argv
[1]);
272 r
= sd_bus_call_method(bus
,
273 "org.freedesktop.timedate1",
274 "/org/freedesktop/timedate1",
275 "org.freedesktop.timedate1",
279 "bb", b
, arg_ask_password
);
281 log_error("Failed to set ntp: %s", bus_error_message(&error
, r
));
286 static int list_timezones(int argc
, char **argv
, void *userdata
) {
287 _cleanup_strv_free_
char **zones
= NULL
;
290 r
= get_timezones(&zones
);
292 return log_error_errno(r
, "Failed to read list of time zones: %m");
294 (void) pager_open(arg_no_pager
, false);
300 typedef struct NTPStatusInfo
{
301 const char *server_name
;
302 char *server_address
;
303 usec_t poll_interval
, poll_max
, poll_min
;
304 usec_t root_distance_max
;
306 uint32_t leap
, version
, mode
, stratum
;
308 usec_t root_delay
, root_dispersion
;
313 usec_t origin
, recv
, trans
, dest
;
316 uint64_t packet_count
;
322 static void ntp_status_info_clear(NTPStatusInfo
*p
) {
323 p
->server_address
= mfree(p
->server_address
);
326 static const char * const ntp_leap_table
[4] = {
328 [1] = "last minute of the day has 61 seconds",
329 [2] = "last minute of the day has 59 seconds",
330 [3] = "not synchronized",
333 #pragma GCC diagnostic push
334 #pragma GCC diagnostic ignored "-Wtype-limits"
335 DEFINE_PRIVATE_STRING_TABLE_LOOKUP_TO_STRING(ntp_leap
, uint32_t);
336 #pragma GCC diagnostic pop
338 static void print_ntp_status_info(NTPStatusInfo
*i
) {
339 char ts
[FORMAT_TIMESPAN_MAX
], tmin
[FORMAT_TIMESPAN_MAX
], tmax
[FORMAT_TIMESPAN_MAX
];
340 usec_t delay
, t14
, t23
, offset
, root_distance
;
346 * "Timestamp Name ID When Generated
347 * ------------------------------------------------------------
348 * Originate Timestamp T1 time request sent by client
349 * Receive Timestamp T2 time request received by server
350 * Transmit Timestamp T3 time reply sent by server
351 * Destination Timestamp T4 time reply received by client
353 * The round-trip delay, d, and system clock offset, t, are defined as:
354 * d = (T4 - T1) - (T3 - T2) t = ((T2 - T1) + (T3 - T4)) / 2"
357 printf(" Server: %s (%s)\n",
358 i
->server_address
, i
->server_name
);
359 printf("Poll interval: %s (min: %s; max %s)\n",
360 format_timespan(ts
, sizeof(ts
), i
->poll_interval
, 0),
361 format_timespan(tmin
, sizeof(tmin
), i
->poll_min
, 0),
362 format_timespan(tmax
, sizeof(tmax
), i
->poll_max
, 0));
364 if (i
->packet_count
== 0) {
365 printf(" Packet count: 0\n");
369 if (i
->dest
< i
->origin
|| i
->trans
< i
->recv
|| i
->dest
- i
->origin
< i
->trans
- i
->recv
) {
370 log_error("Invalid NTP response");
374 delay
= (i
->dest
- i
->origin
) - (i
->trans
- i
->recv
);
376 t14
= i
->origin
+ i
->dest
;
377 t23
= i
->recv
+ i
->trans
;
378 offset_sign
= t14
< t23
;
379 offset
= (offset_sign
? t23
- t14
: t14
- t23
) / 2;
381 root_distance
= i
->root_delay
/ 2 + i
->root_dispersion
;
384 " Version: %" PRIu32
"\n"
385 " Stratum: %" PRIu32
"\n",
386 ntp_leap_to_string(i
->leap
),
390 printf(" Reference: %s\n", i
->reference
.str
);
392 printf(" Reference: %" PRIX32
"\n", be32toh(i
->reference
.val
));
393 printf(" Precision: %s (%" PRIi32
")\n",
394 format_timespan(ts
, sizeof(ts
), DIV_ROUND_UP((nsec_t
) (exp2(i
->precision
) * NSEC_PER_SEC
), NSEC_PER_USEC
), 0),
396 printf("Root distance: %s (max: %s)\n",
397 format_timespan(ts
, sizeof(ts
), root_distance
, 0),
398 format_timespan(tmax
, sizeof(tmax
), i
->root_distance_max
, 0));
399 printf(" Offset: %s%s\n",
400 offset_sign
? "+" : "-",
401 format_timespan(ts
, sizeof(ts
), offset
, 0));
402 printf(" Delay: %s\n",
403 format_timespan(ts
, sizeof(ts
), delay
, 0));
404 printf(" Jitter: %s\n",
405 format_timespan(ts
, sizeof(ts
), i
->jitter
, 0));
406 printf(" Packet count: %" PRIu64
"\n", i
->packet_count
);
409 printf(" Frequency: %+.3fppm\n",
410 (double) i
->freq
/ 0x10000);
413 static int map_server_address(sd_bus
*bus
, const char *member
, sd_bus_message
*m
, sd_bus_error
*error
, void *userdata
) {
414 char **p
= (char **) userdata
;
421 r
= sd_bus_message_enter_container(m
, 'r', "iay");
425 r
= sd_bus_message_read(m
, "i", &family
);
429 r
= sd_bus_message_read_array(m
, 'y', &d
, &sz
);
433 r
= sd_bus_message_exit_container(m
);
437 if (sz
== 0 && family
== AF_UNSPEC
) {
442 if (!IN_SET(family
, AF_INET
, AF_INET6
)) {
443 log_error("Unknown address family %i", family
);
447 if (sz
!= FAMILY_ADDRESS_SIZE(family
)) {
448 log_error("Invalid address size");
452 r
= in_addr_to_string(family
, d
, p
);
459 static int map_ntp_message(sd_bus
*bus
, const char *member
, sd_bus_message
*m
, sd_bus_error
*error
, void *userdata
) {
460 NTPStatusInfo
*p
= userdata
;
468 r
= sd_bus_message_enter_container(m
, 'r', "uuuuittayttttbtt");
472 r
= sd_bus_message_read(m
, "uuuuitt",
473 &p
->leap
, &p
->version
, &p
->mode
, &p
->stratum
, &p
->precision
,
474 &p
->root_delay
, &p
->root_dispersion
);
478 r
= sd_bus_message_read_array(m
, 'y', &d
, &sz
);
482 r
= sd_bus_message_read(m
, "ttttbtt",
483 &p
->origin
, &p
->recv
, &p
->trans
, &p
->dest
,
484 &b
, &p
->packet_count
, &p
->jitter
);
488 r
= sd_bus_message_exit_container(m
);
495 memcpy(p
->reference
.str
, d
, sz
);
502 static int show_timesync_status_once(sd_bus
*bus
) {
503 static const struct bus_properties_map map_timesync
[] = {
504 { "ServerName", "s", NULL
, offsetof(NTPStatusInfo
, server_name
) },
505 { "ServerAddress", "(iay)", map_server_address
, offsetof(NTPStatusInfo
, server_address
) },
506 { "PollIntervalUSec", "t", NULL
, offsetof(NTPStatusInfo
, poll_interval
) },
507 { "PollIntervalMinUSec", "t", NULL
, offsetof(NTPStatusInfo
, poll_min
) },
508 { "PollIntervalMaxUSec", "t", NULL
, offsetof(NTPStatusInfo
, poll_max
) },
509 { "RootDistanceMaxUSec", "t", NULL
, offsetof(NTPStatusInfo
, root_distance_max
) },
510 { "NTPMessage", "(uuuuittayttttbtt)", map_ntp_message
, 0 },
511 { "Frequency", "x", NULL
, offsetof(NTPStatusInfo
, freq
) },
514 _cleanup_(ntp_status_info_clear
) NTPStatusInfo info
= {};
515 _cleanup_(sd_bus_error_free
) sd_bus_error error
= SD_BUS_ERROR_NULL
;
516 _cleanup_(sd_bus_message_unrefp
) sd_bus_message
*m
= NULL
;
521 r
= bus_map_all_properties(bus
,
522 "org.freedesktop.timesync1",
523 "/org/freedesktop/timesync1",
525 BUS_MAP_BOOLEAN_AS_BOOL
,
530 return log_error_errno(r
, "Failed to query server: %s", bus_error_message(&error
, r
));
532 if (arg_monitor
&& !terminal_is_dumb())
533 fputs(ANSI_HOME_CLEAR
, stdout
);
535 print_ntp_status_info(&info
);
540 static int on_properties_changed(sd_bus_message
*m
, void *userdata
, sd_bus_error
*error
) {
546 r
= sd_bus_message_read(m
, "s", &name
);
548 return log_error_errno(r
, "Failed to read interface name: %m");
550 if (!streq_ptr(name
, "org.freedesktop.timesync1.Manager"))
553 return show_timesync_status_once(sd_bus_message_get_bus(m
));
556 static int show_timesync_status(int argc
, char **argv
, void *userdata
) {
557 _cleanup_(sd_event_unrefp
) sd_event
*event
= NULL
;
558 sd_bus
*bus
= userdata
;
563 r
= show_timesync_status_once(bus
);
570 r
= sd_event_default(&event
);
572 return log_error_errno(r
, "Failed to get event loop: %m");
574 r
= sd_bus_match_signal(bus
,
576 "org.freedesktop.timesync1",
577 "/org/freedesktop/timesync1",
578 "org.freedesktop.DBus.Properties",
580 on_properties_changed
, NULL
);
582 return log_error_errno(r
, "Failed to request match for PropertiesChanged signal: %m");
584 r
= sd_bus_attach_event(bus
, event
, SD_EVENT_PRIORITY_NORMAL
);
586 return log_error_errno(r
, "Failed to attach bus to event loop: %m");
588 r
= sd_event_loop(event
);
590 return log_error_errno(r
, "Failed to run event loop: %m");
595 #define property(name, fmt, ...) \
598 printf(fmt "\n", __VA_ARGS__); \
600 printf("%s=" fmt "\n", name, __VA_ARGS__); \
603 static int print_timesync_property(const char *name
, sd_bus_message
*m
, bool value
, bool all
) {
605 const char *contents
;
611 r
= sd_bus_message_peek_type(m
, &type
, &contents
);
617 case SD_BUS_TYPE_STRUCT
:
618 if (streq(name
, "NTPMessage")) {
619 _cleanup_(ntp_status_info_clear
) NTPStatusInfo i
= {};
620 char ts
[FORMAT_TIMESPAN_MAX
], stamp
[FORMAT_TIMESTAMP_MAX
];
622 r
= map_ntp_message(NULL
, NULL
, m
, NULL
, &i
);
626 if (i
.packet_count
== 0)
634 printf("{ Leap=%u, Version=%u, Mode=%u, Stratum=%u, Precision=%i,",
635 i
.leap
, i
.version
, i
.mode
, i
.stratum
, i
.precision
);
636 printf(" RootDelay=%s,",
637 format_timespan(ts
, sizeof(ts
), i
.root_delay
, 0));
638 printf(" RootDispersion=%s,",
639 format_timespan(ts
, sizeof(ts
), i
.root_dispersion
, 0));
642 printf(" Reference=%s,", i
.reference
.str
);
644 printf(" Reference=%" PRIX32
",", be32toh(i
.reference
.val
));
646 printf(" OriginateTimestamp=%s,",
647 format_timestamp(stamp
, sizeof(stamp
), i
.origin
));
648 printf(" ReceiveTimestamp=%s,",
649 format_timestamp(stamp
, sizeof(stamp
), i
.recv
));
650 printf(" TransmitTimestamp=%s,",
651 format_timestamp(stamp
, sizeof(stamp
), i
.trans
));
652 printf(" DestinationTimestamp=%s,",
653 format_timestamp(stamp
, sizeof(stamp
), i
.dest
));
654 printf(" Ignored=%s PacketCount=%" PRIu64
",",
655 yes_no(i
.spike
), i
.packet_count
);
656 printf(" Jitter=%s }\n",
657 format_timespan(ts
, sizeof(ts
), i
.jitter
, 0));
661 } else if (streq(name
, "ServerAddress")) {
662 _cleanup_free_
char *str
= NULL
;
664 r
= map_server_address(NULL
, NULL
, m
, NULL
, &str
);
668 if (arg_all
|| !isempty(str
))
669 property(name
, "%s", str
);
679 static int show_timesync(int argc
, char **argv
, void *userdata
) {
680 sd_bus
*bus
= userdata
;
685 r
= bus_print_all_properties(bus
,
686 "org.freedesktop.timesync1",
687 "/org/freedesktop/timesync1",
688 print_timesync_property
,
694 return bus_log_parse_error(r
);
699 static int help(void) {
700 printf("%s [OPTIONS...] COMMAND ...\n\n"
701 "Query or change system time and date settings.\n\n"
702 " -h --help Show this help message\n"
703 " --version Show package version\n"
704 " --no-pager Do not pipe output into a pager\n"
705 " --no-ask-password Do not prompt for password\n"
706 " -H --host=[USER@]HOST Operate on remote host\n"
707 " -M --machine=CONTAINER Operate on local container\n"
708 " --adjust-system-clock Adjust system clock when changing local RTC mode\n"
709 " --monitor Monitor status of systemd-timesyncd\n"
710 " -p --property=NAME Show only properties by this name\n"
711 " -a --all Show all properties, including empty ones\n"
712 " --value When showing properties, only print the value\n"
715 " status Show current time settings\n"
716 " show Show properties of systemd-timedated\n"
717 " set-time TIME Set system time\n"
718 " set-timezone ZONE Set system time zone\n"
719 " list-timezones Show known time zones\n"
720 " set-local-rtc BOOL Control whether RTC is in local time\n"
721 " set-ntp BOOL Enable or disable network time synchronization\n"
723 "systemd-timesyncd Commands:\n"
724 " timesync-status Show status of systemd-timesyncd\n"
725 " show-timesync Show properties of systemd-timesyncd\n"
726 , program_invocation_short_name
);
731 static int verb_help(int argc
, char **argv
, void *userdata
) {
735 static int parse_argv(int argc
, char *argv
[]) {
740 ARG_ADJUST_SYSTEM_CLOCK
,
746 static const struct option options
[] = {
747 { "help", no_argument
, NULL
, 'h' },
748 { "version", no_argument
, NULL
, ARG_VERSION
},
749 { "no-pager", no_argument
, NULL
, ARG_NO_PAGER
},
750 { "host", required_argument
, NULL
, 'H' },
751 { "machine", required_argument
, NULL
, 'M' },
752 { "no-ask-password", no_argument
, NULL
, ARG_NO_ASK_PASSWORD
},
753 { "adjust-system-clock", no_argument
, NULL
, ARG_ADJUST_SYSTEM_CLOCK
},
754 { "monitor", no_argument
, NULL
, ARG_MONITOR
},
755 { "property", required_argument
, NULL
, 'p' },
756 { "all", no_argument
, NULL
, 'a' },
757 { "value", no_argument
, NULL
, ARG_VALUE
},
766 while ((c
= getopt_long(argc
, argv
, "hH:M:p:a", options
, NULL
)) >= 0)
777 arg_transport
= BUS_TRANSPORT_REMOTE
;
782 arg_transport
= BUS_TRANSPORT_MACHINE
;
786 case ARG_NO_ASK_PASSWORD
:
787 arg_ask_password
= false;
790 case ARG_ADJUST_SYSTEM_CLOCK
:
791 arg_adjust_system_clock
= true;
803 r
= strv_extend(&arg_property
, optarg
);
807 /* If the user asked for a particular
808 * property, show it to him, even if it is
826 assert_not_reached("Unhandled option");
832 static int timedatectl_main(sd_bus
*bus
, int argc
, char *argv
[]) {
834 static const Verb verbs
[] = {
835 { "status", VERB_ANY
, 1, VERB_DEFAULT
, show_status
},
836 { "show", VERB_ANY
, 1, 0, show_properties
},
837 { "set-time", 2, 2, 0, set_time
},
838 { "set-timezone", 2, 2, 0, set_timezone
},
839 { "list-timezones", VERB_ANY
, 1, 0, list_timezones
},
840 { "set-local-rtc", 2, 2, 0, set_local_rtc
},
841 { "set-ntp", 2, 2, 0, set_ntp
},
842 { "timesync-status", VERB_ANY
, 1, 0, show_timesync_status
},
843 { "show-timesync", VERB_ANY
, 1, 0, show_timesync
},
844 { "help", VERB_ANY
, VERB_ANY
, 0, verb_help
}, /* Not documented, but supported since it is created. */
848 return dispatch_verb(argc
, argv
, verbs
, bus
);
851 int main(int argc
, char *argv
[]) {
855 setlocale(LC_ALL
, "");
856 log_parse_environment();
859 r
= parse_argv(argc
, argv
);
863 r
= bus_connect_transport(arg_transport
, arg_host
, false, &bus
);
865 log_error_errno(r
, "Failed to create bus connection: %m");
869 r
= timedatectl_main(bus
, argc
, argv
);
872 /* make sure we terminate the bus connection first, and then close the
873 * pager, see issue #3543 for the details. */
874 sd_bus_flush_close_unref(bus
);
877 return r
< 0 ? EXIT_FAILURE
: EXIT_SUCCESS
;