[systemd-devel] Testing if timesyncd is synced
Lennart Poettering
lennart at poettering.net
Wed Feb 20 15:18:33 UTC 2019
On Mi, 20.02.19 11:18, Mantas Mikulėnas (grawity at gmail.com) wrote:
> Call adjtimex(2) and check whether buf.status has STA_UNSYNC (should be
> unset when clock is synchronized).
>
> The systemd-timedated helper service (org.freedesktop.timedate1) exposes
> the same flag as the org.freedesktop.timedate1.NTPSynchronized property on
> /org/freedesktop/timedate1.
Adding to this:
"timedatectl" shows this in a user friendly way btw.
"busctl get-property org.freedesktop.timedate1
/org/freedesktop/timedate1 org.freedesktop.timedate1 NTPSynchronized"
is a nice way to get this problematically in a shell parsable fashion.
> (That said, this deliberately won't work if you've configured timesyncd to
> use "local time" instead of UTC, as timesyncd doesn't want to activate RTC
> updates in that mode.)
It's not that we don't want to. The kernel's "11min" mode doesn't do
that in that case, iirc. i.e. timesyncd isn't the one syncing stuff
down, it's the kernel on its own.
Lennart
--
Lennart Poettering, Red Hat
More information about the systemd-devel
mailing list