timedate_zbus/
lib.rs

1// Copyright 2023 System76 <info@system76.com>
2// SPDX-License-Identifier: MPL-2.0
3
4//! # DBus interface proxy for: `org.freedesktop.timedate1`
5//!
6//! This code was generated by `zbus-xmlgen` `3.1.0` from DBus introspection data.
7//! Source: `Interface '/org/freedesktop/timedate1' from service 'org.freedesktop.timedate1' on system bus`.
8//!
9//! This DBus object implements
10//! [standard DBus interfaces](https://dbus.freedesktop.org/doc/dbus-specification.html),
11//! (`org.freedesktop.DBus.*`) for which the following zbus proxies can be used:
12//!
13//! * [`zbus::fdo::PeerProxy`]
14//! * [`zbus::fdo::IntrospectableProxy`]
15//! * [`zbus::fdo::PropertiesProxy`]
16//!
17
18use zbus::dbus_proxy;
19
20#[dbus_proxy(
21    interface = "org.freedesktop.timedate1",
22    default_service = "org.freedesktop.timedate1",
23    default_path = "/org/freedesktop/timedate1"
24)]
25trait TimeDate {
26    /// A list of time zones known on the local system as an array of names.
27    fn list_timezones(&self) -> zbus::Result<Vec<String>>;
28
29    /// Control whether the RTC is in local time zone or UTC.
30    #[dbus_proxy(name = "SetLocalRTC")]
31    fn set_local_rtc(
32        &self,
33        local_rtc: bool,
34        fix_system: bool,
35        interactive: bool,
36    ) -> zbus::Result<()>;
37
38    /// Control whether the system clock is synchronized with the network using `systemd-timesyncd`.
39    #[dbus_proxy(name = "SetNTP")]
40    fn set_ntp(&self, use_ntp: bool, interactive: bool) -> zbus::Result<()>;
41
42    /// Change the system clock.
43    fn set_time(&self, usec_utc: i64, relative: bool, interactive: bool) -> zbus::Result<()>;
44
45    /// Set the system time zone.
46    fn set_timezone(&self, timezone: &str, interactive: bool) -> zbus::Result<()>;
47
48    /// Shows whether a service to perform time synchronization over network is available.
49    #[dbus_proxy(property, name = "CanNTP")]
50    fn can_ntp(&self) -> zbus::Result<bool>;
51
52    /// Shows whether the RTC is configured to use UTC or the local time zone.
53    #[dbus_proxy(property, name = "LocalRTC")]
54    fn local_rtc(&self) -> zbus::Result<bool>;
55
56    /// Shows whether the NTP service is enabled.
57    #[dbus_proxy(property, name = "NTP")]
58    fn ntp(&self) -> zbus::Result<bool>;
59
60    /// Shows whether the kernel reports the time as synchronized.
61    #[dbus_proxy(property, name = "NTPSynchronized")]
62    fn ntp_synchronized(&self) -> zbus::Result<bool>;
63
64    /// Shows the current time in RTC.
65    #[dbus_proxy(property, name = "RTCTimeUSec")]
66    fn rtctime_usec(&self) -> zbus::Result<u64>;
67
68    /// Shows the current time.
69    #[dbus_proxy(property, name = "TimeUSec")]
70    fn time_usec(&self) -> zbus::Result<u64>;
71
72    /// Shows the currently-configured time zone.
73    #[dbus_proxy(property)]
74    fn timezone(&self) -> zbus::Result<String>;
75}