1 <?xml version='
1.0'
?> <!--*-nxml-*-->
2 <!DOCTYPE refentry PUBLIC
"-//OASIS//DTD DocBook XML V4.5//EN"
3 "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
4 <!-- SPDX-License-Identifier: LGPL-2.1-or-later -->
6 <refentry id=
"timedatectl" conditional='ENABLE_TIMEDATECTL'
7 xmlns:
xi=
"http://www.w3.org/2001/XInclude">
10 <title>timedatectl
</title>
11 <productname>systemd
</productname>
15 <refentrytitle>timedatectl
</refentrytitle>
16 <manvolnum>1</manvolnum>
20 <refname>timedatectl
</refname>
21 <refpurpose>Control the system time and date
</refpurpose>
26 <command>timedatectl
</command>
27 <arg choice=
"opt" rep=
"repeat">OPTIONS
</arg>
28 <arg choice=
"req">COMMAND
</arg>
33 <title>Description
</title>
35 <para><command>timedatectl
</command> may be used to query and change the system clock and its settings,
36 and enable or disable time synchronization services.
</para>
39 <citerefentry><refentrytitle>systemd-firstboot
</refentrytitle><manvolnum>1</manvolnum></citerefentry>
40 to initialize the system time zone for mounted (but not booted)
43 <para><command>timedatectl
</command> may be used to show the current status of time synchronization
45 <citerefentry><refentrytitle>systemd-timesyncd.service
</refentrytitle><manvolnum>8</manvolnum></citerefentry>.
51 <title>Commands
</title>
53 <para>The following commands are understood:
</para>
57 <term><command>status
</command></term>
59 <listitem><para>Show current settings of the system clock and RTC, including whether network time
60 synchronization is active. If no command is specified, this is the implied default.
63 <xi:include href=
"version-info.xml" xpointer=
"v195"/></listitem>
67 <term><command>show
</command></term>
69 <listitem><para>Show the same information as
<option>status
</option>, but in machine readable form.
70 This command is intended to be used whenever computer-parsable output is required.
71 Use
<option>status
</option> if you are looking for formatted human-readable output.
</para>
72 <para>By default, empty properties are suppressed. Use
<option>--all
</option> to show those too.
73 To select specific properties to show, use
<option>--property=
</option>.
</para>
75 <xi:include href=
"version-info.xml" xpointer=
"v239"/></listitem>
79 <term><command>set-time [TIME]
</command></term>
81 <listitem><para>Set the system clock to the specified time.
82 This will also update the RTC time accordingly. The time may
83 be specified in the format
"2012-10-30
86 <xi:include href=
"version-info.xml" xpointer=
"v195"/></listitem>
90 <term><command>set-timezone [TIMEZONE]
</command></term>
92 <listitem><para>Set the system time zone to the specified
93 value. Available timezones can be listed with
94 <command>list-timezones
</command>. If the RTC is configured to
95 be in the local time, this will also update the RTC time. This
96 call will alter the
<filename>/etc/localtime
</filename>
98 <citerefentry><refentrytitle>localtime
</refentrytitle><manvolnum>5</manvolnum></citerefentry>
99 for more information.
</para>
101 <xi:include href=
"version-info.xml" xpointer=
"v195"/></listitem>
105 <term><command>list-timezones
</command></term>
107 <listitem><para>List available time zones, one per line.
108 Entries from the list can be set as the system timezone with
109 <command>set-timezone
</command>.
</para>
111 <xi:include href=
"version-info.xml" xpointer=
"v195"/></listitem>
115 <term><command>set-local-rtc [BOOL]
</command></term>
117 <listitem><para>Takes a boolean argument. If
118 <literal>0</literal>, the system is configured to maintain the
119 RTC in universal time. If
<literal>1</literal>, it will
120 maintain the RTC in local time instead. Note that maintaining
121 the RTC in the local timezone is not fully supported and will
122 create various problems with time zone changes and daylight
123 saving adjustments. If at all possible, keep the RTC in UTC
124 mode. Note that invoking this will also synchronize the RTC
125 from the system clock, unless
126 <option>--adjust-system-clock
</option> is passed (see above).
127 This command will change the
3rd line of
128 <filename>/etc/adjtime
</filename>, as documented in
129 <citerefentry project='man-pages'
><refentrytitle>hwclock
</refentrytitle><manvolnum>8</manvolnum></citerefentry>.
132 <xi:include href=
"version-info.xml" xpointer=
"v195"/></listitem>
136 <term><command>set-ntp [BOOL]
</command></term>
138 <listitem><para>Takes a boolean argument. Controls whether network time synchronization is active and
139 enabled (if available). If the argument is true, this enables and starts the first existing network
140 synchronization service. If the argument is false, then this disables and stops the known network
141 synchronization services. The way that the list of services is built is described in
142 <citerefentry><refentrytitle>systemd-timedated.service
</refentrytitle><manvolnum>8</manvolnum></citerefentry>.
145 <xi:include href=
"version-info.xml" xpointer=
"v195"/></listitem>
151 <title>systemd-timesyncd Commands
</title>
153 <para>The following commands are specific to
154 <citerefentry><refentrytitle>systemd-timesyncd.service
</refentrytitle><manvolnum>8</manvolnum></citerefentry>.
159 <term><command>timesync-status
</command></term>
161 <listitem><para>Show current status of
162 <citerefentry><refentrytitle>systemd-timesyncd.service
</refentrytitle><manvolnum>8</manvolnum></citerefentry>.
163 If
<option>--monitor
</option> is specified, then this will monitor the status updates.
</para>
165 <xi:include href=
"version-info.xml" xpointer=
"v239"/></listitem>
169 <term><command>show-timesync
</command></term>
171 <listitem><para>Show the same information as
<option>timesync-status
</option>, but in machine readable form.
172 This command is intended to be used whenever computer-parsable output is required.
173 Use
<option>timesync-status
</option> if you are looking for formatted human-readable output.
</para>
174 <para>By default, empty properties are suppressed. Use
<option>--all
</option> to show those too.
175 To select specific properties to show, use
<option>--property=
</option>.
</para>
177 <xi:include href=
"version-info.xml" xpointer=
"v239"/></listitem>
181 <term><command>ntp-servers
<replaceable>INTERFACE
</replaceable> <replaceable>SERVER
</replaceable>…
</command></term>
183 <listitem><para>Set the interface specific NTP servers. This command can be used only when the
184 interface is managed by
<command>systemd-networkd
</command>.
</para>
186 <xi:include href=
"version-info.xml" xpointer=
"v243"/></listitem>
190 <term><command>revert
<replaceable>INTERFACE
</replaceable></command></term>
192 <listitem><para>Revert the interface specific NTP servers. This command can be used only when
193 the interface is managed by
<command>systemd-networkd
</command>.
</para>
195 <xi:include href=
"version-info.xml" xpointer=
"v243"/></listitem>
204 <title>Options
</title>
206 <para>The following options are understood:
</para>
210 <term><option>--no-ask-password
</option></term>
212 <listitem><para>Do not query the user for authentication for
213 privileged operations.
</para>
215 <xi:include href=
"version-info.xml" xpointer=
"v195"/></listitem>
219 <term><option>--adjust-system-clock
</option></term>
221 <listitem><para>If
<command>set-local-rtc
</command> is invoked
222 and this option is passed, the system clock is synchronized
223 from the RTC again, taking the new setting into account.
224 Otherwise, the RTC is synchronized from the system
227 <xi:include href=
"version-info.xml" xpointer=
"v195"/></listitem>
231 <term><option>--monitor
</option></term>
233 <listitem><para>If
<command>timesync-status
</command> is invoked and this option is passed, then
234 <command>timedatectl
</command> monitors the status of
235 <citerefentry><refentrytitle>systemd-timesyncd.service
</refentrytitle><manvolnum>8</manvolnum></citerefentry>
236 and updates the outputs. Use
<keycombo><keycap>Ctrl
</keycap><keycap>C
</keycap></keycombo> to terminate the
239 <xi:include href=
"version-info.xml" xpointer=
"v239"/></listitem>
243 <term><option>-a
</option></term>
244 <term><option>--all
</option></term>
246 <listitem><para>When showing properties of
247 <citerefentry><refentrytitle>systemd-timesyncd.service
</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
248 show all properties regardless of whether they are set or not.
</para>
250 <xi:include href=
"version-info.xml" xpointer=
"v239"/></listitem>
254 <term><option>-p
</option></term>
255 <term><option>--property=
</option></term>
257 <listitem><para>When showing properties of
258 <citerefentry><refentrytitle>systemd-timesyncd.service
</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
259 limit display to certain properties as specified as argument. If not specified, all set properties are shown.
260 The argument should be a property name, such as
<literal>ServerName
</literal>. If specified more than once,
261 all properties with the specified names are shown.
</para>
263 <xi:include href=
"version-info.xml" xpointer=
"v239"/></listitem>
267 <term><option>--value
</option></term>
270 <para>When printing properties with
<command>show-timesync
</command>, only print the value, and skip the
271 property name and
<literal>=
</literal>.
</para>
273 <xi:include href=
"version-info.xml" xpointer=
"v239"/></listitem>
276 <varlistentry id='option-P'
>
277 <term><option>-P
</option></term>
280 <xi:include href=
"standard-options.xml" xpointer=
"xpointer(//varlistentry[@id='option-P']/listitem/para)" />
281 <xi:include href=
"version-info.xml" xpointer=
"v256"/>
285 <xi:include href=
"user-system-options.xml" xpointer=
"host" />
286 <xi:include href=
"user-system-options.xml" xpointer=
"machine" />
288 <xi:include href=
"standard-options.xml" xpointer=
"help" />
289 <xi:include href=
"standard-options.xml" xpointer=
"version" />
290 <xi:include href=
"standard-options.xml" xpointer=
"no-pager" />
295 <title>Exit status
</title>
297 <para>On success,
0 is returned, a non-zero failure code otherwise.
</para>
300 <xi:include href=
"common-variables.xml" />
303 <title>Examples
</title>
304 <para>Show current settings:
305 <programlisting>$ timedatectl
306 Local time: Thu
2017-
09-
21 16:
08:
56 CEST
307 Universal time: Thu
2017-
09-
21 14:
08:
56 UTC
308 RTC time: Thu
2017-
09-
21 14:
08:
56
309 Time zone: Europe/Warsaw (CEST, +
0200)
310 System clock synchronized: yes
312 RTC in local TZ: no
</programlisting>
315 <para>Enable network time synchronization:
316 <programlisting>$ timedatectl set-ntp true
317 ==== AUTHENTICATING FOR org.freedesktop.timedate1.set-ntp ===
318 Authentication is required to control whether network time synchronization shall be enabled.
319 Authenticating as: user
321 ==== AUTHENTICATION COMPLETE ===
</programlisting>
323 <programlisting>$ systemctl status systemd-timesyncd.service
324 ● systemd-timesyncd.service - Network Time Synchronization
325 Loaded: loaded (/usr/lib/systemd/system/systemd-timesyncd.service; enabled)
326 Active: active (running) since Mo
2015-
03-
30 14:
20:
38 CEST;
5s ago
327 Docs: man:systemd-timesyncd.service(
8)
328 Main PID:
595 (systemd-timesyn)
329 Status:
"Using Time Server 216.239.38.15:123 (time4.google.com)."
330 CGroup: /system.slice/systemd-timesyncd.service
331 └─
595 /usr/lib/systemd/systemd-timesyncd
335 <para>Show current status of
336 <citerefentry><refentrytitle>systemd-timesyncd.service
</refentrytitle><manvolnum>8</manvolnum></citerefentry>:
337 <programlisting>$ timedatectl timesync-status
338 Server:
216.239.38.15 (time4.google.com)
339 Poll interval:
1min
4s (min:
32s; max
34min
8s)
345 Root distance:
335us (max:
5s)
350 Frequency: -
8.802ppm
</programlisting>
356 <title>See Also
</title>
357 <para><simplelist type=
"inline">
358 <member><citerefentry><refentrytitle>systemd
</refentrytitle><manvolnum>1</manvolnum></citerefentry></member>
359 <member><citerefentry project='man-pages'
><refentrytitle>hwclock
</refentrytitle><manvolnum>8</manvolnum></citerefentry></member>
360 <member><citerefentry project='man-pages'
><refentrytitle>date
</refentrytitle><manvolnum>1</manvolnum></citerefentry></member>
361 <member><citerefentry><refentrytitle>localtime
</refentrytitle><manvolnum>5</manvolnum></citerefentry></member>
362 <member><citerefentry><refentrytitle>systemctl
</refentrytitle><manvolnum>1</manvolnum></citerefentry></member>
363 <member><citerefentry><refentrytitle>systemd-timedated.service
</refentrytitle><manvolnum>8</manvolnum></citerefentry></member>
364 <member><citerefentry><refentrytitle>systemd-timesyncd.service
</refentrytitle><manvolnum>8</manvolnum></citerefentry></member>
365 <member><citerefentry><refentrytitle>systemd-firstboot
</refentrytitle><manvolnum>1</manvolnum></citerefentry></member>