[time-nuts] thunderbolt for ntpd or gpsd

Scott Mace smace at intt.net
Wed Aug 27 00:26:52 EDT 2008

Here's another patch that attempts to add leap second parsing to gpsd for
the thunderbolt.  I used the 0X58 UTC_INFO packet and calculated a
the leap second adjustment from delta t LS and delta T LSF store in the
current almanac.  Then use the presence of the leap second pending
alarm and the delta to send ntp a leap second warning.

Ignore the parity none stuff unless you own a thunderbolt.

The 0x58 trick will probably work with devices that use the 0x41 timing packet,
but I don't have a device to test that with.  There are other ways to get
leap second information that may be more straight forward on these devices, but
not on the thunderbolt.  You just get a leap second alarm and then have to
poll the UTC_INFO out of the almanac to get the leap second delta.

The 0x38 poll every 5 seconds is probably overkill, I was just
too impatient to wait to see if the receiver automatically sent a 0x58
packet after an almanac change.  Probably, the 0x38 needs to run
exactly once at startup and then future 0x58 packets will be sent automatically
given the 0x8E-A5 mask, but it doesn't seem to hurt anything.

This was tested with ntp-4.2.4p4 refclock_shm (no changes needed to ntpd).


Chris Kuethe wrote:
> On Sun, Aug 10, 2008 at 1:42 PM, Scott Mace <smace at intt.net> wrote:
>> ntpshm_put() needs to be called in the 0xab case as well for ntp to work.
> done.
>> --- gpsd/trunk/tsip.c   2008-08-08 23:38:27.000000000 -0500
>> +++ ../gpsd/trunk/tsip.c        2008-08-09 04:14:09.000000000 -0500
>> @@ -65,7 +65,7 @@
>>        /* XXX clever heuristic to decide if the parity change is required.
>> */
>>        session->driver.tsip.parity = session->gpsdata.parity;
>>        session->driver.tsip.stopbits = session->gpsdata.stopbits;
>> -       gpsd_set_speed(session, session->gpsdata.baudrate, 'O', 1);
>> +       gpsd_set_speed(session, session->gpsdata.baudrate, 'N', 1);
>>        break;
>>     case 1:
> not committing this - i'd prefer a heuristic to autodetect the parity.
> i'm open to suggestions on how to do that.
>> @@ -674,6 +674,10 @@
>>            session->gpsdata.fix.time =  session->gpsdata.sentence_time =
>>              gpstime_to_unix((int)s1, f1) - (double)u1;
>> +#ifdef NTPSHM_ENABLE
>> +           if (session->context->enable_ntpshm)
>> +
>> (void)ntpshm_put(session,session->gpsdata.sentence_time+0.075);
>> +#endif
>>            mask |= TIME_SET;
>>          }
> just committed this part...
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gpsd-thunderbolt-leapsecond.patch
Type: text/x-patch
Size: 10920 bytes
Desc: not available
Url : http://www.febo.com/pipermail/time-nuts/attachments/20080826/ae9efefe/attachment.bin 

More information about the time-nuts mailing list