[systemd-devel] Testing if timesyncd is synced

Mantas Mikulėnas grawity at gmail.com
Wed Feb 20 17:36:49 UTC 2019


On Wed, Feb 20, 2019, 19:23 Paul D. DeRocco <pderocco at ix.netcom.com> wrote:

> > From: Mantas Mikulenas [mailto:grawity at gmail.com]
> >
> > 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.
>
> That looks pretty simple. I'll try it out. This is my own Yocto-based
> embedded system with a recent kernel, so there are no issues of
> compatibility, as others warned about.
>

adjtimex(2) the kernel syscall has existed since kernel 2.4.x at least,
possibly even as far back as 1.0. It's older than systemd-timesyncd in any
case.

Others apparently were talking about /bin/adjtimex the standalone
executable, which has certainly been around at least in the 2.6.x era, but
being a CLI app it really makes a poor programming interface anyway.
-- 

Mantas Mikulėnas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20190220/b59771e2/attachment.html>


More information about the systemd-devel mailing list