1 <?xml version='
1.0'
?> <!--*-nxml-*-->
2 <!DOCTYPE refentry PUBLIC
"-//OASIS//DTD DocBook XML V4.2//EN"
3 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
6 SPDX-License-Identifier: LGPL-2.1+
8 This file is part of systemd.
10 Copyright 2012 Lennart Poettering
13 <refentry id=
"timedatectl" conditional='ENABLE_TIMEDATED'
14 xmlns:
xi=
"http://www.w3.org/2001/XInclude">
17 <title>timedatectl
</title>
18 <productname>systemd
</productname>
22 <contrib>Developer
</contrib>
23 <firstname>Lennart
</firstname>
24 <surname>Poettering
</surname>
25 <email>lennart@poettering.net
</email>
31 <refentrytitle>timedatectl
</refentrytitle>
32 <manvolnum>1</manvolnum>
36 <refname>timedatectl
</refname>
37 <refpurpose>Control the system time and date
</refpurpose>
42 <command>timedatectl
<arg choice=
"opt" rep=
"repeat">OPTIONS
</arg> <arg choice=
"req">COMMAND
</arg></command>
47 <title>Description
</title>
49 <para><command>timedatectl
</command> may be used to query and
50 change the system clock and its settings.
</para>
53 <citerefentry><refentrytitle>systemd-firstboot
</refentrytitle><manvolnum>1</manvolnum></citerefentry>
54 to initialize the system time zone for mounted (but not booted)
59 <title>Options
</title>
61 <para>The following options are understood:
</para>
65 <term><option>--no-ask-password
</option></term>
67 <listitem><para>Do not query the user for authentication for
68 privileged operations.
</para></listitem>
72 <term><option>--adjust-system-clock
</option></term>
74 <listitem><para>If
<command>set-local-rtc
</command> is invoked
75 and this option is passed, the system clock is synchronized
76 from the RTC again, taking the new setting into account.
77 Otherwise, the RTC is synchronized from the system
78 clock.
</para></listitem>
81 <xi:include href=
"user-system-options.xml" xpointer=
"host" />
82 <xi:include href=
"user-system-options.xml" xpointer=
"machine" />
84 <xi:include href=
"standard-options.xml" xpointer=
"help" />
85 <xi:include href=
"standard-options.xml" xpointer=
"version" />
86 <xi:include href=
"standard-options.xml" xpointer=
"no-pager" />
91 <title>Commands
</title>
93 <para>The following commands are understood:
</para>
97 <term><command>status
</command></term>
99 <listitem><para>Show current settings of the system clock and RTC,
100 including whether network time synchronization through
101 <filename>systemd-timesyncd.service
</filename> is active. Even if it is
102 inactive, a different service might still synchronize the clock.
103 If no command is specified, this is the implied default.
108 <term><command>set-time [TIME]
</command></term>
110 <listitem><para>Set the system clock to the specified time.
111 This will also update the RTC time accordingly. The time may
112 be specified in the format
"2012-10-30
113 18:17:16".
</para></listitem>
117 <term><command>set-timezone [TIMEZONE]
</command></term>
119 <listitem><para>Set the system time zone to the specified
120 value. Available timezones can be listed with
121 <command>list-timezones
</command>. If the RTC is configured to
122 be in the local time, this will also update the RTC time. This
123 call will alter the
<filename>/etc/localtime
</filename>
125 <citerefentry><refentrytitle>localtime
</refentrytitle><manvolnum>5</manvolnum></citerefentry>
126 for more information.
</para></listitem>
130 <term><command>list-timezones
</command></term>
132 <listitem><para>List available time zones, one per line.
133 Entries from the list can be set as the system timezone with
134 <command>set-timezone
</command>.
</para></listitem>
138 <term><command>set-local-rtc [BOOL]
</command></term>
140 <listitem><para>Takes a boolean argument. If
141 <literal>0</literal>, the system is configured to maintain the
142 RTC in universal time. If
<literal>1</literal>, it will
143 maintain the RTC in local time instead. Note that maintaining
144 the RTC in the local timezone is not fully supported and will
145 create various problems with time zone changes and daylight
146 saving adjustments. If at all possible, keep the RTC in UTC
147 mode. Note that invoking this will also synchronize the RTC
148 from the system clock, unless
149 <option>--adjust-system-clock
</option> is passed (see above).
150 This command will change the
3rd line of
151 <filename>/etc/adjtime
</filename>, as documented in
152 <citerefentry project='man-pages'
><refentrytitle>hwclock
</refentrytitle><manvolnum>8</manvolnum></citerefentry>.
157 <term><command>set-ntp [BOOL]
</command></term>
159 <listitem><para>Takes a boolean argument. Controls whether network time synchronization is active
160 and enabled (if available). If the argument is true, this enables and starts the first existed
161 service listed in the environment variable
<varname>$SYSTEMD_TIMEDATED_NTP_SERVICES
</varname>
162 of
<filename>systemd-timedated.service
</filename>. If the argument is false, then this disables and
163 stops the all services listed in
<varname>$SYSTEMD_TIMEDATED_NTP_SERVICES
</varname>.
</para></listitem>
171 <title>Exit status
</title>
173 <para>On success,
0 is returned, a non-zero failure
174 code otherwise.
</para>
177 <xi:include href=
"less-variables.xml" />
180 <title>Examples
</title>
181 <para>Show current settings:
182 <programlisting>$ timedatectl
183 Local time: Thu
2017-
09-
21 16:
08:
56 CEST
184 Universal time: Thu
2017-
09-
21 14:
08:
56 UTC
185 RTC time: Thu
2017-
09-
21 14:
08:
56
186 Time zone: Europe/Warsaw (CEST, +
0200)
187 System clock synchronized: yes
189 RTC in local TZ: no
</programlisting>
192 <para>Enable network time synchronization:
193 <programlisting>$ timedatectl set-ntp true
194 ==== AUTHENTICATING FOR org.freedesktop.timedate1.set-ntp ===
195 Authentication is required to control whether network time synchronization shall be enabled.
196 Authenticating as: user
198 ==== AUTHENTICATION COMPLETE ===
</programlisting>
200 <programlisting>$ systemctl status systemd-timesyncd.service
201 ● systemd-timesyncd.service - Network Time Synchronization
202 Loaded: loaded (/usr/lib/systemd/system/systemd-timesyncd.service; enabled)
203 Active: active (running) since Mo
2015-
03-
30 14:
20:
38 CEST;
5s ago
204 Docs: man:systemd-timesyncd.service(
8)
205 Main PID:
595 (systemd-timesyn)
206 Status:
"Using Time Server 216.239.38.15:123 (time4.google.com)."
207 CGroup: /system.slice/systemd-timesyncd.service
208 └─
595 /usr/lib/systemd/systemd-timesyncd
214 <title>See Also
</title>
216 <citerefentry><refentrytitle>systemd
</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
217 <citerefentry project='man-pages'
><refentrytitle>hwclock
</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
218 <citerefentry project='man-pages'
><refentrytitle>date
</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
219 <citerefentry><refentrytitle>localtime
</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
220 <citerefentry><refentrytitle>systemctl
</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
221 <citerefentry><refentrytitle>systemd-timedated.service
</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
222 <citerefentry><refentrytitle>systemd-timesyncd.service
</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
223 <citerefentry><refentrytitle>systemd-firstboot
</refentrytitle><manvolnum>1</manvolnum></citerefentry>