I have an application on a Linux system (Ubuntu Server) that needs to know whether the current system clock has been synchronized to a NTP server. While I could check timedatectl
's output for System clock synchronized: yes
, this seems very brittle, especially since timedatectl
's human readable output might change in the future.
However, systemd seems to be full of DBus interfaces, so I suspect that there might be a way to check there. Either way, I'm looking for a bool is_ntp_synchronized()
.
Is there any way to simply check whether the system clock is synchronized without starting another process?
ntpdate
, called regularly, but not ntp daemon running]. – Locris