[time-nuts] Warped back to 1993

David Malone dwmalone at maths.tcd.ie
Wed Aug 14 07:44:19 UTC 2013


On Sun, Aug 11, 2013 at 03:12:00PM +0200, Magnus Danielson wrote:
> I'm sure that the NTP drivers can be hacked to make necessary
> adjustments without too much code.

I seem to have been caught by the same time warp (or a similar one)
on a GPS unit that I've been using with our NTP server since 1999.
I doubt I will be able to update the firmware, so I've made the
change shown below to the NTP NMEA refclock. It assumes that your
GPS unit might be slow by a multiple of 1024 weeks, and trys to get
the timestamp within 512 weeks of the current system time before
feeding it to NTP.

The patch seems to work for me, though it may not be pedantically
correct. Hal might have some comments on if it could easily be
improved. It might be an interesting option to have in the NMEA
driver, but it does seem a litle hacky.

	David.


--- refclock_nmea.c.orig	2010-11-10 03:38:22.000000000 +0000
+++ refclock_nmea.c	2013-08-13 20:05:44.000000000 +0100
@@ -979,6 +1076,8 @@
 	date.yearday = 0; /* make sure it's not used */
 	DTOLFP(pp->nsec * 1.0e-9, &reftime);
 	reftime.l_ui += caltontp(&date);
+	while (reftime.l_i + 512*7*86400 < rd_timestamp.l_i)
+		reftime.l_i += 1024*7*86400;
 
 	/* $GPZDG postprocessing first... */
 	if (NMEA_GPZDG == sentence) {



More information about the Time-nuts_lists.febo.com mailing list