Re: [chrony-users] PPS lock status from C |
[ Thread Index |
Date Index
| More chrony.tuxfamily.org/chrony-users Archives
]
- To: chrony-users@xxxxxxxxxxxxxxxxxxxx
- Subject: Re: [chrony-users] PPS lock status from C
- From: Miroslav Lichvar <mlichvar@xxxxxxxxxx>
- Date: Wed, 19 Jul 2023 16:29:08 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1689776952; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=ZacLTDEy+iruMt0wdlPozAhs9Vj7aRT6QO/FofNoUfM=; b=WHjcKaWzUQz4uhDuEGJDxDmLg2ITe5c8sOBpj2Xk3evIUjd/jdRHmgZR6u/TpqVWUOfqPf 2JWcI3S6d22EoVRG4KUA7rkh5tk6eyhyPgROo+cTFX9q9xxt+GcnxrNm+a5Op5N1sqzoSf g+QPfX2812iK5bOj2todPnglto5GAAk=
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.