diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2011-01-15 01:31:28 -0500 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2011-01-15 01:34:23 -0500 |
commit | 4133c10e3cff4d2bd3c83952fac84bf78d8f34f1 (patch) | |
tree | 416ba45a2c7dff42ecf50d57a091dbdc2745fbb5 | |
parent | 42eba3edc67243742fe3a514bed292f3fac559e0 (diff) | |
download | gpsd-4133c10e3cff4d2bd3c83952fac84bf78d8f34f1.tar.gz |
GPS week rollover check extends to the rollover equivalent of now.
-rw-r--r-- | devtools/README | 4 | ||||
-rwxr-xr-x | leapsecond.py | 7 | ||||
-rw-r--r-- | libgpsd_core.c | 3 |
3 files changed, 8 insertions, 6 deletions
diff --git a/devtools/README b/devtools/README index 87b8d8ce..4a16a5b0 100644 --- a/devtools/README +++ b/devtools/README @@ -58,10 +58,6 @@ explanation. Retrieves the latest build logs from Debian's buildds and extracts a list of failed regression tests, sorted by architecture. -== leapsecond.py == - -Gets the current leap-second correction forom IERS and/or the USNO. - == logextract == Extract pure NMEA from an emailed gpsd error log. The output can be fed diff --git a/leapsecond.py b/leapsecond.py index 55e622a9..89cc2927 100755 --- a/leapsecond.py +++ b/leapsecond.py @@ -171,6 +171,7 @@ if __name__ == '__main__': continue fields = line.strip().split() leapsecs.append(leapbound(fields[0], fields[1])) + leapsecs.append(unix_to_rfc822(time.time())) if c_epochs: print ''' /* This code is generated from leapsecond.py; do not hand-hack! */ @@ -183,7 +184,11 @@ int gpsd_check_leapsecond(const int leap, const double unixtime) static double c_epochs[] = {\ ''' for (i, b) in enumerate(leapsecs): - print " %s, // %s -> %d" % (rfc822_to_unix(b), b, i) + if i == len(b) - 1: + label = '?' + else: + label = `i` + print " %s, // %s -> %s" % (rfc822_to_unix(b), b, label) print '''\ }; #define DIM(a) (sizeof(a)/sizeof(a[0])) diff --git a/libgpsd_core.c b/libgpsd_core.c index a4e45521..7ab2a8bc 100644 --- a/libgpsd_core.c +++ b/libgpsd_core.c @@ -851,7 +851,8 @@ void gpsd_rollover_check(/*@in@*/struct gps_device_t *session, * time far enough in the past that it won't be consistent with the * leap-second value. */ - if (gpsd_check_leapsecond(session->context->leap_seconds, unixtime) == 0) { + if ((session->context->valid & LEAP_SECOND_VALID)!=0 && + gpsd_check_leapsecond(session->context->leap_seconds, unixtime) == 0) { char scr[128]; (void)unix_to_iso8601(unixtime, scr, sizeof(scr)); gpsd_report(LOG_WARN, "leap-second %d is impossible at time %s (%f)\n", |