<div dir="ltr"><div dir="ltr">On Wed, Feb 20, 2019 at 3:01 PM Aurelian Melinte <<a href="mailto:ame01@gmx.net">ame01@gmx.net</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div bgcolor="#FFFFFF">
<div class="gmail-m_-579601047384974126moz-cite-prefix">On 20/02/2019 4:18 a.m., Mantas
Mikulėnas wrote:<br>
</div>
<blockquote type="cite">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">On Wed, Feb 20, 2019 at 10:55 AM Paul D.
DeRocco <<a href="mailto:pderocco@ix.netcom.com" target="_blank">pderocco@ix.netcom.com</a>>
wrote:<br>
</div>
<div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">What's the simplest
way to test if systemd-timesyncd is currently synced<br>
to the network, from within an embedded application
(running with root<br>
privileges)? Is there some single dbus transaction that
will give me this<br>
answer?<br>
</blockquote>
<div><br>
</div>
<div>Call adjtimex(2) and check whether buf.status has
STA_UNSYNC (should be unset when clock is synchronized).</div>
<div><br>
</div>
<div>The systemd-timedated helper service
(org.freedesktop.timedate1) exposes the same flag as
the org.freedesktop.timedate1.NTPSynchronized property
on /org/freedesktop/timedate1.</div>
<div><br>
</div>
<div>(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.)</div>
<div><br>
</div>
<div>timesyncd itself exposes several properties including
the actual received NTPMessage, but I'm not sure if it's
as good as an explicit indication. It does emit update
signals however.</div>
</div>
<div><br>
</div>
-- <br>
<div dir="ltr" class="gmail-m_-579601047384974126gmail_signature">
<div dir="ltr">Mantas Mikulėnas</div>
</div>
</div>
</div>
</div>
</blockquote>
<p><br>
</p>
<p>Some (old?) systems do not have adjtimex:</p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">$
adjtimex</span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">-bash:
adjtimex: command not found</span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"></span></p></div></blockquote><div><br></div><div>I wasn't talking about the command-line tool, but about <a href="http://man7.org/linux/man-pages/man2/adjtimex.2.html">the Linux kernel syscall.</a></div><div><br></div></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr">Mantas Mikulėnas</div></div></div>