[time-nuts] GPS for ntp

Hal Murray hmurray at megapathdsl.net
Tue Oct 21 15:20:44 EDT 2014

tvb at LeapSecond.com said:
>> You have to synchronise between the counter 
>> value and what the OS understands is 'system time' in order to create a 
>> retrospective timestamp for when the event occured.

> Also true.

> One solution to the problem is use two independent HW capture inputs. One
> for a GPS 1PPS and the other for your event.

> In this case the system clock does not need to be synchronized -- since it
> is used only to interpolate between the two events. The event timestamp is
> little more than adding the differential of the two most recent captures,
> which is a number from 0 to 1 second. 

You haven't solved the problem yet.  Now you have to synchronize the HW 
capture counters.

You can probably do that with some simple but delicate initialization code.  
Maybe copy the value from the counter used for the system time?  At the 
time-nut level, you have to worry about things like cache misses.  (There may 
be more fine print at that level depending upon the details of the hardware.)

You could also do it by calibrating out the difference: just feed the same 
pulse into both input pins.  You have to do that each time you (re)start 
things.  That's easy for a one-off project but adds another ugly step if you 
want to do it in production.  Collecting long term data moves a hobby project 
a lot closer to production.

These are my opinions.  I hate spam.

More information about the time-nuts mailing list