On 2010-06-30, [email protected] <[email protected]> wrote: > > I am looking at the shared memory structure and code used by NTP and was > wondering if I could get some guidance on these values. The big question is > how NTP uses the clockTime vs the receiveTime. > > Trying to also understand the unit (unitptr) concept and which shared memory > location(s) I should use if I have just a single time source. > > I also do not see a big difference between mode 0 and 1 especially given the > valid field, but maybe someone could shed light on those. I gather precision > is not used? > > struct shmTime { > int mode; /* 0 - if valid set > * use values, > * clear valid > * 1 - if valid set > * if count before and after read of values is equal, > * use values > * clear valid > */ > int count; > time_t clockTimeStampSec; > int clockTimeStampUSec;
The time on the system clock at which the PPS was received > time_t receiveTimeStampSec; > int receiveTimeStampUSec; The absolute time at which the PPS was received. shmpps sets the receiveTimeStampSec to be the rounded value of the clockTimeStampSeci.clockTimeStampUSec Ie, the nearest second to the system clock . The receiveTimeStampUSec is set to 0. This means that the system clock must be within 1/2 sec of the true time. I believe gpsd can set the receiveTimeStampSec from the NMEA sentence. (Note that some gps clocks can give 5 timestamps a second, so then clockTimeStampUSec would not be 0.) > int leap; Is a leap second coming up > int precision; What is the precision of the timestamp (number of significant figures in base 2 essentially) > int nsamples; How many samples is it averaged over I believe. > int valid; Has a new reading come in since the last time the shm was read by ntpd. If not, then do not use the timestamps. > int dummy[10]; > }; Use shmpps to look at how to dump data into the shm. Or just alter gpsd to read the serial data your clock sends rather than what a GPS NMEA receiver sends on the serial line. > > ---------------------------------------------------------------- > This message was sent using IMP, the Internet Messaging Program. _______________________________________________ questions mailing list [email protected] http://lists.ntp.org/listinfo/questions
