proposal for sntp program: include 'delay' in json output

folkert folkert at vanheusden.com
Mon Jan 2 14:10:06 UTC 2023


Just noticed https://ntpsec.org/contributor.html
If you people want to include it, I'll put it in gitlab.

> Hello,
> 
> I would like to suggest the following small tweak for the sntp program:
> 
> --- sorg	2023-01-02 14:45:52.975926908 +0100
> +++ /usr/bin/sntp	2023-01-02 14:44:13.322691440 +0100
> @@ -216,12 +216,12 @@
>  
>      if json:
>          say('{"time":"%sT%s%s","offset":%f,"precision":%f,"host":"%s",'
> -            '"ip":"%s","stratum":%s,"leap":"%s","adjusted":%s}\n'
> +            '"ip":"%s","stratum":%s,"leap":"%s","adjusted":%s,"delay":%f}\n'
>              % (date, tod, tz,
>                 packet.adjust(), packet.synchd(),
>                 packet.hostname, packet.resolved or packet.hostname,
>                 packet.stratum, packet.leap(),
> -               "true" if adjusted else "false"))
> +               "true" if adjusted else "false", packet.delta()))
>      else:
>          say("%s %s (%s) %+f +/- %f %s"
>              % (date, tod, tz,
> 
> It makes it include the delay in the json output.


More information about the devel mailing list