Re: [chrony-users] chrony usecase - to set the system time if the system have no RTC

[ Thread Index | Date Index | More Archives ]

On Fri, Dec 18, 2015 at 10:15:29AM +0000, Jahagirdar, Bhushan wrote:
> >Maybe the program that is feeding chronyd has switched the sample time with reference time?
> Can you please let me know more details on what is sample time and reference time and how to feed this to chronyd? Is there any documentation that points to the specifications that are needed in client application that feeds reference time to chronyd?

Unfortunately, there is no documentation, only the source code.

Reference time is the true time from the reference clock. Sample time
is the local system time to which that reference time corresponds,
i.e. when that measurement was made as measured by the system clock.

In the SHM sample they are stored as clockTimeStamp and
receiveTimeStamp respectively. In the SOCK sample the reference time
is not saved directly, but there is offset between the reference time
and sample time.

The SOCK sample has the following fields:

  struct timeval tv;
    system time of the measurement

  double offset;
    difference between reference time and the tv field (ref - tv)

  int pulse;
    if not zero the refclock is just a PPS signal, i.e. only the
    sub-second part of the offset is valid and another source is
    needed to obtain seconds

  int leap;
    0 - normal
    1 - leap second will be inserted in last minute of the day
    2 - leap second will be deleted in last minute of the day

  int _pad;
    padding for alignment, ignored

  int magic;
    always 0x534f434b

If the system clock is initialized to 1970-01-01 00:00:00 UTC, in the
first SOCK sample received by chronyd the tv.tv_sec value should be
close to zero and the offset should be around 1.4504e9. When chronyd
steps the clock (if allowed by the makestep directive), tv.tv_sec will
be the current time and the offset should be close to zero.

Please let me know if chronyd doesn't work with that.

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+