<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">On 20/02/2019 4:18 a.m., Mantas
Mikulėnas wrote:<br>
</div>
<blockquote type="cite"
cite="mid:CAPWNY8X_5a1Vx+ehvsG=vHvGYNNr+Xmk4ZmGugft2d8O6LsEMA@mail.gmail.com">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<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"
moz-do-not-send="true">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_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:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">$
adjtimex</span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">-bash:
adjtimex: command not found</span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D"> </span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">$
ntpstat</span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">unsynchronised</span></p>
<p>
<span
style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">
polling server every 8 s</span></p>
<br>
<div id="DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2"><br />
<table style="border-top: 1px solid #D3D4DE;">
<tr>
<td style="width: 55px; padding-top: 13px;"><a href="https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient" target="_blank"><img src="https://ipmcdn.avast.com/images/icons/icon-envelope-tick-round-orange-animated-no-repeat-v1.gif" alt="" width="46" height="29" style="width: 46px; height: 29px;" /></a></td>
<td style="width: 470px; padding-top: 12px; color: #41424e; font-size: 13px; font-family: Arial, Helvetica, sans-serif; line-height: 18px;">Virus-free. <a href="https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient" target="_blank" style="color: #4453ea;">www.avast.com</a>
</td>
</tr>
</table><a href="#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2" width="1" height="1"> </a></div></body>
</html>