[ntp:questions] ntpd - gpsd communication

Miroslav Lichvar mlichvar at redhat.com
Tue Jun 9 06:57:30 UTC 2020

On 2020-06-08, ah at avtodoria.ru <ah at avtodoria.ru> wrote:
> Currently i'm looking at ntp sources. as i said i have read data from
> SHM at June 4th, now i'm trying to write them into SHM. What i see in
> ntpq output:
> You can see reftime is June 4th, but nevertheless offset is small. How
> does it work? When i debug it small offset is before even clock select
> algotirhm, so who calculates such small offset at June 8th

It's not possible to replay old SHM data at a different time. Have a
look at the SHM structure. There are receiveTimeStamp fields, which tell
at what time the sample was captured (system time) and clockTimeStamp
fields which tell what time the reference clock had at the time of the
capture. The difference is the offset. If you want to replay an offset,
you need to put in the SHM segment the current system time and the same
time adjusted for the offset, so their difference is the offset as it
was before.

But this completely ignores the process that is controlling the clock,
so I'm not sure what value this exercise has.

Miroslav Lichvar

More information about the questions mailing list