[ntp:questions] NTP Shared Memory Driver

unruh unruh at invalid.ca
Tue Jun 26 13:41:14 UTC 2012


Look at the program shmpps which takes a pps signal, and populates the
shm structure with the current offset .


On 2012-06-25, Damien Dusha <d.dusha at gmail.com> wrote:
> Dear NTP list,
>
> I would like to use the shared memory driver to push time from a GPS
> receiver into NTP (Note 1) - host OS is Linux, using NTP 4.2.6p5.
> According to documentation at
> http://www.eecis.udel.edu/~mills/ntp/html/drivers/driver28.html, I
> need to populate the following structure in shared memory:
>
> 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;????? /* external clock */
> ? int??? clockTimeStampUSec;???? /* external clock */
> ? time_t receiveTimeStampSec;??? /* internal clock, when external
> value was received */
> ? int??? receiveTimeStampUSec;?? /* internal clock, when external
> value was received */
> ? int??? leap;
> ? int??? precision;
> ? int??? nsamples;
> ? int??? valid;
> ? int??? dummy[10];
> };
>
> Whilst "mode" is clearly documented in the designated HTML page, the
> remaining fields are not and it's not obvious as to how they should be
> populated.
>
> For poking around ntpd and gpsd, I have made guesses that:
>   * The timestamps are unix timestamps in UTC
>   * "leap" is an enumeration 0 - 3, though I am not entirely sure of
> its meaning, (3 is unknown leap seconds applied?)
>   * "Precision" is 2^(precision) seconds estimated accuracy
>   * "count" and "valid" are populated according to the "mode" selected
>
> But this is little more than a stab in the dark. Is there a better
> place where these fields are documented that I have missed?
>
> Regards,
> Damien.
>
> (Note 1: In this project, we are processing our own GPS solution and
> time based on raw observables and are hence are not using NMEA or
> other GPS protocol. PPS is supplied to us via a GPIO line and we are
> using the ATOM driver to capture this via linuxpps).



More information about the questions mailing list