summaryrefslogtreecommitdiff
path: root/gpsd.c
diff options
context:
space:
mode:
authorGary E. Miller <gem@rellim.com>2015-05-28 19:27:35 -0700
committerGary E. Miller <gem@rellim.com>2015-05-28 19:27:35 -0700
commit82d4eb4886da49807100b8b63dd138cbb1dab397 (patch)
treedd3348a5558d6870e55f9a6cfc6edefa70466ec3 /gpsd.c
parent653cae0825dd0c3a50b0db6fa464eeb7fb4e983c (diff)
downloadgpsd-82d4eb4886da49807100b8b63dd138cbb1dab397.tar.gz
Stop reporting bad GPS serial time to ntp/chrony.
When no fix present, GPS serial time, which is usually useless, was still sent to ntpshm and chrony sockets. Garmin was guarding the time properly, but no other driver. NMEA driver used to do this until commit a9f44d1cb9db5a27832782bbe2685e66433c6d3a in 2013. Other drivers had this bug a longer time. This shows up the need for time regression testing.
Diffstat (limited to 'gpsd.c')
-rw-r--r--gpsd.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/gpsd.c b/gpsd.c
index e81268de..2bce7934 100644
--- a/gpsd.c
+++ b/gpsd.c
@@ -1508,6 +1508,9 @@ static void all_reports(struct gps_device_t *device, gps_mask_t changed)
*/
if ((changed & TIME_SET) == 0) {
//gpsd_log(&context.errout, LOG_PROG, "NTP: No time this packet\n");
+ } else if ( 0 >= device->fixcnt ) {
+ /* many GPS spew random times until a valid GPS fix */
+ //gpsd_log(&context.errout, LOG_PROG, "NTP: no fix\n");
} else if (isnan(device->newdata.time)) {
//gpsd_log(&context.errout, LOG_PROG, "NTP: bad new time\n");
#if defined(PPS_ENABLE)