]> git.ipfire.org Git - thirdparty/systemd.git/blame - man/org.freedesktop.timedate1.xml
docs: use "polkit" to refer to PolicyKit
[thirdparty/systemd.git] / man / org.freedesktop.timedate1.xml
CommitLineData
9c970e5f
ZJS
1<?xml version='1.0'?>
2<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
3 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" >
4<!-- SPDX-License-Identifier: LGPL-2.1+ -->
5
6<refentry id="org.freedesktop.timedate1" conditional='ENABLE_TIMEDATED'
7 xmlns:xi="http://www.w3.org/2001/XInclude">
8 <refentryinfo>
9 <title>org.freedesktop.timedate1</title>
10 <productname>systemd</productname>
11 </refentryinfo>
12
13 <refmeta>
14 <refentrytitle>org.freedesktop.timedate1</refentrytitle>
15 <manvolnum>5</manvolnum>
16 </refmeta>
17
18 <refnamediv>
19 <refname>org.freedesktop.timedate1</refname>
20 <refpurpose>The D-Bus interface of systemd-timedated</refpurpose>
21 </refnamediv>
22
23 <refsect1>
24 <title>Introduction</title>
25
26 <para>
27 <citerefentry><refentrytitle>systemd-timedated.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>
ca264f7d 28 is a system service that can be used to control the system time and related settings. This page
9c970e5f
ZJS
29 describes the D-Bus interface.</para>
30 </refsect1>
31
32 <refsect1>
33 <title>The D-Bus API</title>
34
35 <para>The service exposes the following interfaces on the bus:</para>
36
37 <programlisting>
38$ gdbus introspect --system \
39 --dest org.freedesktop.timedate1 \
40 --object-path /org/freedesktop/timedate1
41
42node /org/freedesktop/timedate1 {
43 interface org.freedesktop.timedate1 {
44 methods:
45 SetTime(in x usec_utc,
46 in b relative,
4fb222c4 47 in b interactive);
9c970e5f 48 SetTimezone(in s timezone,
4fb222c4 49 in b interactive);
9c970e5f
ZJS
50 SetLocalRTC(in b local_rtc,
51 in b fix_system,
4fb222c4 52 in b interactive);
9c970e5f 53 SetNTP(in b use_ntp,
4fb222c4
ZJS
54 in b interactive);
55 ListTimezones(out as timezones);
9c970e5f 56 properties:
4fb222c4
ZJS
57 readonly s Timezone = '...';
58 readonly b LocalRTC = ...;
59 @org.freedesktop.DBus.Property.EmitsChangedSignal("false")
60 readonly b CanNTP = ...;
61 readonly b NTP = ...;
62 @org.freedesktop.DBus.Property.EmitsChangedSignal("false")
63 readonly b NTPSynchronized = ...;
64 @org.freedesktop.DBus.Property.EmitsChangedSignal("false")
65 readonly t TimeUSec = ...;
66 @org.freedesktop.DBus.Property.EmitsChangedSignal("false")
67 readonly t RTCTimeUSec = ...;
9c970e5f 68 };
4fb222c4
ZJS
69 interface org.freedesktop.DBus.Peer { ... };
70 interface org.freedesktop.DBus.Introspectable { ... };
71 interface org.freedesktop.DBus.Properties { ... };
9c970e5f
ZJS
72};
73 </programlisting>
74
00bb75d7
ZJS
75 <!--Autogenerated cross-references for systemd.directives, do not edit-->
76
77 <variablelist class="dbus-interface" generated="True" extra-ref="org.freedesktop.timedate1"/>
78
79 <variablelist class="dbus-interface" generated="True" extra-ref="org.freedesktop.timedate1"/>
80
81 <variablelist class="dbus-method" generated="True" extra-ref="SetTime()"/>
82
83 <variablelist class="dbus-method" generated="True" extra-ref="SetTimezone()"/>
84
85 <variablelist class="dbus-method" generated="True" extra-ref="SetLocalRTC()"/>
86
87 <variablelist class="dbus-method" generated="True" extra-ref="SetNTP()"/>
88
89 <variablelist class="dbus-method" generated="True" extra-ref="ListTimezones()"/>
90
91 <variablelist class="dbus-property" generated="True" extra-ref="Timezone"/>
92
93 <variablelist class="dbus-property" generated="True" extra-ref="LocalRTC"/>
94
95 <variablelist class="dbus-property" generated="True" extra-ref="CanNTP"/>
96
97 <variablelist class="dbus-property" generated="True" extra-ref="NTP"/>
98
99 <variablelist class="dbus-property" generated="True" extra-ref="NTPSynchronized"/>
100
101 <variablelist class="dbus-property" generated="True" extra-ref="TimeUSec"/>
102
103 <variablelist class="dbus-property" generated="True" extra-ref="RTCTimeUSec"/>
104
105 <!--End of Autogenerated section-->
106
9c970e5f
ZJS
107 <refsect2>
108 <title>Methods</title>
109
110 <para>Use <function>SetTime()</function> to change the system clock. Pass a value of microseconds since
111 the UNIX epoch (1 Jan 1970 UTC). If <varname>relative</varname> is true, the passed usec value will be
ca264f7d
DDM
112 added to the current system time. If it is false, the current system time will be set to the passed usec
113 value. If the system time is set with this method, the RTC will be updated as well.</para>
9c970e5f
ZJS
114
115 <para>Use <function>SetTimezone()</function> to set the system timezone. Pass a value like
116 <literal>Europe/Berlin</literal> to set the timezone. Valid timezones are listed in
117 <filename>/usr/share/zoneinfo/zone.tab</filename>. If the RTC is configured to be maintained in local
118 time, it will be updated accordingly.</para>
119
120 <para>Use <function>SetLocalRTC()</function> to control whether the RTC is in local time or UTC. It is
ca264f7d
DDM
121 strongly recommended to maintain the RTC in UTC. However, some OSes (Windows) maintain the RTC in local
122 time, which might make it necessary to enable this feature. Note that this might create various problems as
123 daylight changes could be missed. If <varname>fix_system</varname> is <literal>true</literal>,
124 the time from the RTC is read again and the system clock is adjusted according to the new setting. If
125 <varname>fix_system</varname> is <literal>false</literal>, the system time is written to the RTC
9c970e5f
ZJS
126 taking the new setting into account. Use <varname>fix_system=true</varname> in installers and livecds
127 where the RTC is probably more reliable than the system time. Use <varname>fix_system=false</varname>
128 in configuration UIs that are run during normal operation and where the system clock is probably more
129 reliable than the RTC.</para>
130
131 <para>Use <function>SetNTP()</function> to control whether the system clock is synchronized with the
132 network using <filename>systemd-timesyncd</filename>. This will enable and start or disable and stop
133 the chosen time synchronization service.</para>
134
2a915924
ZJS
135 <para><function>ListTimezones()</function> returns a list of time zones known on the local system as an
136 array of names (<literal>["Africa/Abidjan", "Africa/Accra", ..., "UTC"]</literal>).</para>
137 </refsect2>
138
139 <refsect2>
140 <title>Properties</title>
141
142 <para><varname>Timezone</varname> shows the currently configured time zone.
143 <varname>LocalRTC</varname> shows whether the RTC is configured to use UTC (false), or the local time
144 zone (true). <varname>CanNTP</varname> shows whether a service to perform time synchronization over the
145 network is available, and <varname>NTP</varname> shows whether such a service is enabled.</para>
146
147 <para><varname>NTPSynchronized</varname> shows whether the kernel reports the time as synchronized
148 (c.f.
149 <citerefentry project="man-pages"><refentrytitle>adjtimex</refentrytitle><manvolnum>3</manvolnum></citerefentry>).
150 <varname>TimeUSec</varname> and <varname>RTCTimeUSec</varname> show the current time on the system and
151 in the RTC. The purpose of those three properties is to allow remote clients to access this information
152 over D-Bus. Local clients can access the information directly.</para>
153
154 <para>Whenever the <varname>Timezone</varname> and <varname>LocalRTC</varname> settings are changed via
155 the daemon, <function>PropertyChanged</function> signals are sent out to which clients can subscribe.
156 </para>
9c970e5f
ZJS
157
158 <para>Note that this service will not inform you about system time changes. Use
4fb222c4 159 <citerefentry project="man-pages"><refentrytitle>timerfd</refentrytitle><manvolnum>3</manvolnum></citerefentry>
9c970e5f
ZJS
160 with <constant>CLOCK_REALTIME</constant> and <constant>TFD_TIMER_CANCEL_ON_SET</constant> for that.
161 </para>
2a915924
ZJS
162 </refsect2>
163
164 <refsect2>
165 <title>Security</title>
9c970e5f 166
2a915924 167 <para>The <varname>interactive</varname> boolean parameters can be used to control whether
98ab0dae
ZJS
168 <ulink url="https://www.freedesktop.org/software/polkit/docs/latest/">polkit</ulink>
169 should interactively ask the user for authentication credentials if required.</para>
9c970e5f 170
98ab0dae 171 <para>The polkit action for <function>SetTimezone()</function> is
9c970e5f
ZJS
172 <interfacename>org.freedesktop.timedate1.set-timezone</interfacename>. For
173 <function>SetLocalRTC()</function> it is
174 <interfacename>org.freedesktop.timedate1.set-local-rtc</interfacename>, for
175 <function>SetTime()</function> it is <interfacename>org.freedesktop.timedate1.set-time</interfacename>
176 and for <function>SetNTP()</function> it is
2a915924
ZJS
177 <interfacename>org.freedesktop.timedate1.set-ntp</interfacename>.
178 <function>ListTimezones()</function> does not require any privileges.
179 </para>
9c970e5f
ZJS
180 </refsect2>
181 </refsect1>
182
183 <refsect1>
184 <title>Versioning</title>
185
186 <para>These D-Bus interfaces follow <ulink url="http://0pointer.de/blog/projects/versioning-dbus.html">
187 the usual interface versioning guidelines</ulink>.</para>
188 </refsect1>
189
190 <refsect1>
191 <title>See also</title>
192
193 <para><ulink url="https://lists.freedesktop.org/archives/systemd-devel/2011-May/002526.html">More information on how the system clock and RTC interact</ulink></para>
194 </refsect1>
195</refentry>