[time-nuts] Warped back to 1993

Mark C. Stephens marks at non-stop.com.au
Wed Aug 14 06:24:39 EDT 2013

David, Well Done, your patch has breathed life into some refclocks I thought had reached the end of the road.


-----Original Message-----
From: time-nuts-bounces at febo.com [mailto:time-nuts-bounces at febo.com] On Behalf Of David Malone
Sent: Wednesday, 14 August 2013 5:44 PM
To: Magnus Danielson
Cc: time-nuts at febo.com
Subject: Re: [time-nuts] Warped back to 1993

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.


--- 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) {
time-nuts mailing list -- time-nuts at febo.com To unsubscribe, go to https://www.febo.com/cgi-bin/mailman/listinfo/time-nuts
and follow the instructions there.

More information about the time-nuts mailing list