[ntp:questions] Start of new GPS 1024 week epoch

Terje Mathisen "terje.mathisen at tmsw.no" at ntp.org
Wed Aug 14 07:13:33 UTC 2013

David Malone wrote:
> It seems my ancient GPSclock 200 has recently slipped back to
> December 1993 too. Resetting it hasn't helped and I doubt I will
> be able to do a firmware update, so I've made a hack to refclock_nmea.c
> (version ntp-4.2.6p5), by replacing:
>          reftime.l_ui += caltontp(&date);
> with
>          reftime.l_ui += caltontp(&date);
> 	while (reftime.l_i + 512*7*86400 < rd_timestamp.l_i)
> 		reftime.l_i += 1024*7*86400;


You've replaced the 1024-week epoch with a +/- 512-week window around 
the "current" time. :-)
> I'm trying to adjust the timestamp given by NMEA might be slow by
> some multiple of 1024 weeks, and so tries to adjust it so that it
> is reasonably close to the system time associated with the read of
> the NMEA data.  I'm not sure if I've got the code exactly bang-on,
> but it has got ntp running with the unit again.

Looks good.


- <Terje.Mathisen at tmsw.no>
"almost all programming can be viewed as an exercise in caching"

More information about the questions mailing list