当前位置: 首页 > news >正文

systemd-timedated.service Dbus参考

https://www.freedesktop.org/software/systemd/man/latest/org.freedesktop.timedate1.html

 

Name

org.freedesktop.timedate1 — The D-Bus interface of systemd-timedated

Introduction

systemd-timedated.service(8) is a system service that can be used to control the system time and related settings. This page describes the D-Bus interface.

The D-Bus API

The service exposes the following interfaces on the bus:

node /org/freedesktop/timedate1 {interface org.freedesktop.timedate1 {methods:SetTime(in  x usec_utc,in  b relative,in  b interactive);SetTimezone(in  s timezone,in  b interactive);SetLocalRTC(in  b local_rtc,in  b fix_system,in  b interactive);SetNTP(in  b use_ntp,in  b interactive);ListTimezones(out as timezones);properties:readonly s Timezone = '...';readonly b LocalRTC = ...;@org.freedesktop.DBus.Property.EmitsChangedSignal("false")readonly b CanNTP = ...;readonly b NTP = ...;@org.freedesktop.DBus.Property.EmitsChangedSignal("false")readonly b NTPSynchronized = ...;@org.freedesktop.DBus.Property.EmitsChangedSignal("false")readonly t TimeUSec = ...;@org.freedesktop.DBus.Property.EmitsChangedSignal("false")readonly t RTCTimeUSec = ...;};interface org.freedesktop.DBus.Peer { ... };interface org.freedesktop.DBus.Introspectable { ... };interface org.freedesktop.DBus.Properties { ... };
};
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Methods

Use SetTime() to change the system clock. Pass a value of microseconds since the UNIX epoch (1 Jan 1970 UTC). If relative is true, the passed usec value will be added to the current system time. If it is false, the current system time will be set to the passed usec value. If the system time is set with this method, the RTC will be updated as well.

Use SetTimezone() to set the system timezone. Pass a value like "Europe/Berlin" to set the timezone. Valid timezones are listed in /usr/share/zoneinfo/zone.tab. If the RTC is configured to be maintained in local time, it will be updated accordingly.

Use SetLocalRTC() to control whether the RTC is in local time or UTC. It is strongly recommended to maintain the RTC in UTC. However, some OSes (Windows) maintain the RTC in local time, which might make it necessary to enable this feature. Note that this might create various problems as daylight changes could be missed. If fix_system is "true", the time from the RTC is read again and the system clock is adjusted according to the new setting. If fix_system is "false", the system time is written to the RTC taking the new setting into account. Use fix_system=true in installers and livecds where the RTC is probably more reliable than the system time. Use fix_system=false in configuration UIs that are run during normal operation and where the system clock is probably more reliable than the RTC.

Use SetNTP() to control whether the system clock is synchronized with the network using systemd-timesyncd. This will enable and start or disable and stop the chosen time synchronization service.

ListTimezones() returns a list of time zones known on the local system as an array of names ("["Africa/Abidjan", "Africa/Accra", ..., "UTC"]").

Properties

Timezone shows the currently configured time zone. LocalRTC shows whether the RTC is configured to use UTC (false), or the local time zone (true). CanNTP shows whether a service to perform time synchronization over the network is available, and NTP shows whether such a service is enabled.

NTPSynchronized shows whether the kernel reports the time as synchronized (c.f. adjtimex(3)). TimeUSec and RTCTimeUSec show the current time on the system and in the RTC. The purpose of those three properties is to allow remote clients to access this information over D-Bus. Local clients can access the information directly.

Whenever the Timezone and LocalRTC settings are changed via the daemon, PropertyChanged signals are sent out to clients which have subscribed.

Note that this service will not inform you about system time changes. Use timerfd(3) with CLOCK_REALTIME and TFD_TIMER_CANCEL_ON_SET for that.

Security

The interactive boolean parameters can be used to control whether polkit should interactively ask the user for authentication credentials if required.

The polkit action for SetTimezone() is org.freedesktop.timedate1.set-timezone. For SetLocalRTC() it is org.freedesktop.timedate1.set-local-rtc, for SetTime() it is org.freedesktop.timedate1.set-time and for SetNTP() it is org.freedesktop.timedate1.set-ntpListTimezones() does not require any privileges.

Examples

Example 1. Introspect org.freedesktop.timedate1 on the bus

$ gdbus introspect --system \--dest org.freedesktop.timedate1 \--object-path /org/freedesktop/timedate1

Versioning

These D-Bus interfaces follow the usual interface versioning guidelines.

See Also

systemd(1)systemd-timedated.service(8)timedatectl(1), More information on how the system clock and RTC interact

http://www.jsqmd.com/news/38437/

相关文章:

  • 2025年比较好的防火岩棉板厂家实力及用户口碑排行榜
  • 2025年口碑好的链条输送机实力厂家TOP推荐榜
  • 2025年比较好的超强承重天地铰链厂家实力及用户口碑排行榜
  • 传统企业能源管理痛点破解:MyEMS 如何解决 “数据散、分析难、优化慢” 三大核心问题?
  • Magisk体系:Android Root权限的工程化部署方案
  • 2025年评价高的绿篱修剪机最新TOP厂家排名
  • MX Round 23 解题报告
  • 2025年质量好的载带成型机用户口碑最好的厂家榜
  • 【转】Milo库OPCUA协议java实现
  • 2025年热门的超低压反渗透膜最新TOP品牌厂家排行
  • 2025年口碑好的门式起重机最新TOP厂家排名
  • 2025年热门的立式明装风机盘管TOP品牌厂家排行榜
  • 2025年耐用的微型磁力齿轮泵厂家推荐及选购指南
  • 2025年11月酶制剂品牌对比榜:五家代表企业深度解析
  • 2025年靠谱的轻型卡车天窗用户好评厂家排行
  • 2025年11月酶制剂品牌评价榜:五强性能与口碑综合排行
  • 2025年11月白酒曲厂家推荐榜:机械化制曲排行评测
  • 2025年11月酵母抽提物品牌榜:五强横评与鲜味稳定性对比
  • 2025年11月蛋白胨厂家对比榜:五家代表企业综合评测报告
  • 2025年质量好的上海裸眼3DLED显示屏厂家推荐及选购参考榜
  • 【TIDE DIARY 4.1】Agentic RAG - 详解
  • 2025年11月酵母抽提物品牌口碑榜:五强排名与关键指标对比
  • 2025年11月白酒曲厂家推荐榜:五家口碑对比与性能评测
  • Nov 12
  • 2025年专业的nfc标签厂家最新推荐排行榜
  • 2025年11月酵母抽提物品牌推荐:年度榜对比与鲜味性能评价
  • 2025年诺士诚公司:全过程工程咨询资质全景深度解析
  • 2025年专业的亚克力制品行业内知名厂家排行榜
  • 详细介绍:Zephyr RTOS在智能家居中的应用:智能插座开发
  • 2025年口碑好的免拉手封边条厂家推荐及选购参考榜