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 This file is part of systemd.
8 Copyright 2012 Lennart Poettering
10 systemd is free software; you can redistribute it and/or modify it
11 under the terms of the GNU Lesser General Public License as published by
12 the Free Software Foundation; either version 2.1 of the License, or
13 (at your option) any later version.
15 systemd is distributed in the hope that it will be useful, but
16 WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 Lesser General Public License for more details.
20 You should have received a copy of the GNU Lesser General Public License
21 along with systemd; If not, see <http://www.gnu.org/licenses/>.
24 <refentry id=
"timedatectl" conditional='ENABLE_TIMEDATED'
25 xmlns:
xi=
"http://www.w3.org/2001/XInclude">
28 <title>timedatectl
</title>
29 <productname>systemd
</productname>
33 <contrib>Developer
</contrib>
34 <firstname>Lennart
</firstname>
35 <surname>Poettering
</surname>
36 <email>lennart@poettering.net
</email>
42 <refentrytitle>timedatectl
</refentrytitle>
43 <manvolnum>1</manvolnum>
47 <refname>timedatectl
</refname>
48 <refpurpose>Control the system time and date
</refpurpose>
53 <command>timedatectl
<arg choice=
"opt" rep=
"repeat">OPTIONS
</arg> <arg choice=
"req">COMMAND
</arg></command>
58 <title>Description
</title>
60 <para><command>timedatectl
</command> may be used to query and
61 change the system clock and its settings.
</para>
64 <citerefentry><refentrytitle>systemd-firstboot
</refentrytitle><manvolnum>1</manvolnum></citerefentry>
65 to initialize the system time zone for mounted (but not booted)
70 <title>Options
</title>
72 <para>The following options are understood:
</para>
76 <term><option>--no-ask-password
</option></term>
78 <listitem><para>Do not query the user for authentication for
79 privileged operations.
</para></listitem>
83 <term><option>--adjust-system-clock
</option></term>
85 <listitem><para>If
<command>set-local-rtc
</command> is invoked
86 and this option is passed, the system clock is synchronized
87 from the RTC again, taking the new setting into account.
88 Otherwise, the RTC is synchronized from the system
89 clock.
</para></listitem>
92 <xi:include href=
"user-system-options.xml" xpointer=
"host" />
93 <xi:include href=
"user-system-options.xml" xpointer=
"machine" />
95 <xi:include href=
"standard-options.xml" xpointer=
"help" />
96 <xi:include href=
"standard-options.xml" xpointer=
"version" />
97 <xi:include href=
"standard-options.xml" xpointer=
"no-pager" />
100 <para>The following commands are understood:
</para>
104 <term><command>status
</command></term>
106 <listitem><para>Show current settings of the system clock and
107 RTC, including whether NTP is enabled. Note that the NTP state
108 simply reflects whether the
109 <filename>systemd-timesyncd.service
</filename> unit is enabled.
</para></listitem>
113 <term><command>set-time [TIME]
</command></term>
115 <listitem><para>Set the system clock to the specified time.
116 This will also update the RTC time accordingly. The time may
117 be specified in the format
"2012-10-30
118 18:17:16".
</para></listitem>
122 <term><command>set-timezone [TIMEZONE]
</command></term>
124 <listitem><para>Set the system time zone to the specified
125 value. Available timezones can be listed with
126 <command>list-timezones
</command>. If the RTC is configured to
127 be in the local time, this will also update the RTC time. This
128 call will alter the
<filename>/etc/localtime
</filename>
130 <citerefentry><refentrytitle>localtime
</refentrytitle><manvolnum>5</manvolnum></citerefentry>
131 for more information.
</para></listitem>
135 <term><command>list-timezones
</command></term>
137 <listitem><para>List available time zones, one per line.
138 Entries from the list can be set as the system timezone with
139 <command>set-timezone
</command>.
</para></listitem>
143 <term><command>set-local-rtc [BOOL]
</command></term>
145 <listitem><para>Takes a boolean argument. If
146 <literal>0</literal>, the system is configured to maintain the
147 RTC in universal time. If
<literal>1</literal>, it will
148 maintain the RTC in local time instead. Note that maintaining
149 the RTC in the local timezone is not fully supported and will
150 create various problems with time zone changes and daylight
151 saving adjustments. If at all possible, keep the RTC in UTC
152 mode. Note that invoking this will also synchronize the RTC
153 from the system clock, unless
154 <option>--adjust-system-clock
</option> is passed (see above).
155 This command will change the
3rd line of
156 <filename>/etc/adjtime
</filename>, as documented in
157 <citerefentry project='man-pages'
><refentrytitle>hwclock
</refentrytitle><manvolnum>8</manvolnum></citerefentry>.
162 <term><command>set-ntp [BOOL]
</command></term>
164 <listitem><para>Takes a boolean argument. Controls whether NTP
165 based network time synchronization is enabled (if
166 available). This enables or disables the
167 <filename>systemd-timesyncd.service
</filename>
168 unit.
</para></listitem>
176 <title>Exit status
</title>
178 <para>On success,
0 is returned, a non-zero failure
179 code otherwise.
</para>
182 <xi:include href=
"less-variables.xml" />
185 <title>Examples
</title>
186 <para>Show current settings:
187 <programlisting>$ timedatectl
188 Local time: Fri,
2012-
11-
02 09:
26:
46 CET
189 Universal time: Fri,
2012-
11-
02 08:
26:
46 UTC
190 RTC time: Fri,
2012-
11-
02 08:
26:
45
191 Timezone: Europe/Warsaw
197 Last DST change: CEST → CET, DST became inactive
198 Sun,
2012-
10-
28 02:
59:
59 CEST
199 Sun,
2012-
10-
28 02:
00:
00 CET
200 Next DST change: CET → CEST, DST will become active
201 the clock will jump one hour forward
202 Sun,
2013-
03-
31 01:
59:
59 CET
203 Sun,
2013-
03-
31 03:
00:
00 CEST
</programlisting>
206 <para>Enable an NTP daemon (chronyd):
207 <programlisting>$ timedatectl set-ntp true
208 ==== AUTHENTICATING FOR org.freedesktop.timedate1.set-ntp ===
209 Authentication is required to control whether network time synchronization shall be enabled.
210 Authenticating as: user
212 ==== AUTHENTICATION COMPLETE ===
</programlisting>
214 <programlisting>$ systemctl status chronyd.service
215 chronyd.service - NTP client/server
216 Loaded: loaded (/usr/lib/systemd/system/chronyd.service; enabled)
217 Active: active (running) since Fri,
2012-
11-
02 09:
36:
25 CET;
5s ago
223 <title>See Also
</title>
225 <citerefentry><refentrytitle>systemd
</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
226 <citerefentry project='man-pages'
><refentrytitle>hwclock
</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
227 <citerefentry project='man-pages'
><refentrytitle>date
</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
228 <citerefentry><refentrytitle>localtime
</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
229 <citerefentry><refentrytitle>systemctl
</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
230 <citerefentry><refentrytitle>systemd-timedated.service
</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
231 <citerefentry><refentrytitle>systemd-timesyncd.service
</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
232 <citerefentry><refentrytitle>systemd-firstboot
</refentrytitle><manvolnum>1</manvolnum></citerefentry>