Re: [chrony-users] Newbie Help Needed

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


> That could work. However, you will need to either combine the PPS
> timestamp with the serial data,

I thought that by setting BOTH the clockTimestampSec, from the Linux
system time at moment of PPS fire, AND the receiveTimestampSec, from the
CSAC's time value, that I WAS combining the PPS data with the serial
data ???

 or provide two separate refclocks (one
> PPS and one non-PPS) and let chronyd combine the data.
> 

When you talk of a 'PPS refclock', does this mean that this 'refclock'
is fed samples of Linux system time, with those times corresponding to
PPS fire events from my CSAC?

> You would need to use the SOCK protocol for the later as SHM cannot
> transport PPS-only samples. The chrony configuration would look like
> this:
> 
> refclock SOCK /var/run/chrony.serial.sock refid CSAC noselect
> refclock SOCK /var/run/chrony.pps.sock refid PPS lock CSAC


> 
> For development and debugging, it might help to have an additional
> (NTP) source and mark both refclocks with noselect and disable the
> lock to see if they work as expected.
> 
> In a pseudocode the program would do something like this:
> 
> 	fd1 = socket(AF_UNIX, SOCK_DGRAM, 0);
> 	connect(fd1, {"/var/run/chrony.serial.sock"});
> 	fd2 = socket(AF_UNIX, SOCK_DGRAM, 0);
> 	connect(fd2, {"/var/run/chrony.pps.sock"});
> 
> 	gettimeofday(&sample.tv);
> 	sample.offset = sample.tv - CSAC; // or negative value of that?
> 	sample.pulse = 0;
> 	sample.leap = 0;
> 	sample.magic = SOCK_MAGIC;
> 
> 	send(fd1, &sample, sizeof sample, 0);
> 
> 	sample.tv_sec = pps_timestamp.tv_sec;
> 	sample.tv_usec = pps_timestamp.tv_nsec / 1000;
> 	sample.offset = pps_timestamp.tv_nsec / 1e9;
> 	sample.pulse = 1;
> 	sample.leap = 0;
> 	sample.magic = SOCK_MAGIC;
> 
> 	send(fd2, &sample, sizeof sample, 0);
> 
> A working example for sending SOCK samples is here:
> https://github.com/mlichvar/ntp-refclock/blob/master/sock.c
> 
> Does that help?
> 

This is indeed VERY helpful.  The above is code I can understand and use
going forwards.  MUCH appreciated!

Cheers

Stuart


-- 
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/