Question about adding custom serial time source with PPS to chrony

Awais Muhammad <[email protected]> Thu, 27 Nov 2025 07:16:22 +0100
Newsgroups gmane.comp.time.chrony.user
Message-ID <CAJNrmSZqpM=E=6ck9+UgkwWV8r35qHzpbGKxWrf+14cPySBwcQ@mail.gmail.com>
--000000000000577e9606448d742d
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Hello,

I=E2=80=99m working on a system where a microcontroller receives CAN messag=
es from
a GNSS sensor, extracts the GNSS timestamps, and outputs the time over an
RS-232 serial port. The PPS signal comes directly from the sensor and is
available to the Linux PPS subsystem (/dev/pps0).

I=E2=80=99m aware of the standard approach using gpsd =E2=86=92 SHM / SOCK =
=E2=86=92 chrony, where
gpsd reads time from a serial device and aligns it with PPS. I=E2=80=99ve t=
ested
this path and it works, but I=E2=80=99m exploring whether chrony can use th=
e serial
time data directly, without gpsd in the middle.

My question is:

What would be required to add support in chrony for a custom serial
refclock that provides timestamps along with a PPS signal?

Specifically:

I would like chrony to read ASCII time messages from /dev/ttyS0.

PPS would still be handled through the kernel PPS interface (/dev/pps0).

The timestamps are already aligned with PPS at the microcontroller level.


I=E2=80=99m trying to understand whether a new refclock driver (similar to =
SHM,
SOCK, or NMEA) would be the right approach, and what the minimal set of
functions/structures would be for integrating such a driver into chrony=E2=
=80=99s
refclock framework.

Any pointers, examples of existing drivers that are easiest to start from,
or architectural guidance on how chrony expects to correlate a serial time
source with PPS, would be greatly appreciated.

Thank you,
Awais

--000000000000577e9606448d742d
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"auto"><div dir=3D"auto">Hello,</div><div dir=3D"auto"><br></div=
><div dir=3D"auto">I=E2=80=99m working on a system where a microcontroller =
receives CAN messages from a GNSS sensor, extracts the GNSS timestamps, and=
 outputs the time over an RS-232 serial port. The PPS signal comes directly=
 from the sensor and is available to the Linux PPS subsystem (/dev/pps0).</=
div><div dir=3D"auto"><br></div><div dir=3D"auto">I=E2=80=99m aware of the =
standard approach using gpsd =E2=86=92 SHM / SOCK =E2=86=92 chrony, where g=
psd reads time from a serial device and aligns it with PPS. I=E2=80=99ve te=
sted this path and it works, but I=E2=80=99m exploring whether chrony can u=
se the serial time data directly, without gpsd in the middle.</div><div dir=
=3D"auto"><br></div><div dir=3D"auto">My question is:</div><div dir=3D"auto=
"><br></div><div dir=3D"auto">What would be required to add support in chro=
ny for a custom serial refclock that provides timestamps along with a PPS s=
ignal?</div><div dir=3D"auto"><br></div><div dir=3D"auto">Specifically:</di=
v><div dir=3D"auto"><br></div><div dir=3D"auto">I would like chrony to read=
 ASCII time messages from /dev/ttyS0.</div><div dir=3D"auto"><br></div><div=
 dir=3D"auto">PPS would still be handled through the kernel PPS interface (=
/dev/pps0).</div><div dir=3D"auto"><br></div><div dir=3D"auto">The timestam=
ps are already aligned with PPS at the microcontroller level.</div><div dir=
=3D"auto"><br></div><div dir=3D"auto"><br></div><div dir=3D"auto">I=E2=80=
=99m trying to understand whether a new refclock driver (similar to SHM, SO=
CK, or NMEA) would be the right approach, and what the minimal set of funct=
ions/structures would be for integrating such a driver into chrony=E2=80=99=
s refclock framework.</div><div dir=3D"auto"><br></div><div dir=3D"auto">An=
y pointers, examples of existing drivers that are easiest to start from, or=
 architectural guidance on how chrony expects to correlate a serial time so=
urce with PPS, would be greatly appreciated.</div><div dir=3D"auto"><br></d=
iv><div dir=3D"auto">Thank you,</div><div dir=3D"auto">Awais</div></div>

--000000000000577e9606448d742d--

-- 
To unsubscribe email chrony-users-request-kWFZVVI9zxvPqho9SqqRMmD2FQJk+8+b@public.gmane.org 
with "unsubscribe" in the subject.
For help email chrony-users-request-kWFZVVI9zxvPqho9SqqRMmD2FQJk+8+b@public.gmane.org 
with "help" in the subject.
Trouble?  Email [email protected]