Re: [chrony-users] PPS lock status from C

[ Thread Index | Date Index | More chrony.tuxfamily.org/chrony-users Archives ]


On Tue, Jul 18, 2023 at 04:34:19PM -0700, Thangalin wrote:
>   adjtimex(&t);
>   printf( "%d\n", t.status & STA_PPSSIGNAL);
> }
> 
> That works for ntpd, not for chronyd.

This works only when ntpd is configured to give up the control of the
clock to the kernel (kernel PPS discipline).

> Mirsoslav recommended looking at the chrony sources (e.g., client.c,
> candm.h). That was helpful. It looks like we'd need to do the following:
> 
> * Declare a structure of type CMD_Reply.
> * Open the PPS device (e.g., /dev/pps1).
> * Read the device data into the CMD_Reply structure.

You would need to open the chronyd socket and send a request to it
before you get a message containing CMD_Reply.

There is a new library which makes this much easier:
https://gitlab.com/chrony/libchrony

See the example.

> Ideally, some direction to look at that'd work for both ntpd and chronyd
> would be much appreciated. If that's simply not possible, then tips on
> creating a simpler solution would also be helpful.

There is no solution that would work for both chronyd and ntpd. They
use different monitoring protocols. The ntp distribution includes
libntpq.

-- 
Miroslav Lichvar


-- 
To unsubscribe email chrony-users-request@xxxxxxxxxxxxxxxxxxxx 
with "unsubscribe" in the subject.
For help email chrony-users-request@xxxxxxxxxxxxxxxxxxxx 
with "help" in the subject.
Trouble?  Email listmaster@xxxxxxxxxxxxxxxxxxxx.


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/