diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2006-10-23 20:18:33 +0000 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2006-10-23 20:18:33 +0000 |
commit | b8c09af54f9a359bb6b868675ffeb8ceec710e78 (patch) | |
tree | 24e63180bbb2a94963398d8e55071b93c4c29c6f | |
parent | 4d33f62e589ca9bf27d6d43683e5606b04e27f08 (diff) | |
download | gpsd-b8c09af54f9a359bb6b868675ffeb8ceec710e78.tar.gz |
Move the logic for poking the NTP daemomn out of the NMEA driver.
-rw-r--r-- | drivers.c | 14 | ||||
-rw-r--r-- | gpsd.h | 4 | ||||
-rw-r--r-- | libgpsd_core.c | 14 |
3 files changed, 15 insertions, 17 deletions
@@ -85,20 +85,6 @@ gps_mask_t nmea_parse_input(struct gps_device_t *session) session->gpsdata.ldisc = NMEADISC; } #endif - -#ifdef NTPSHM_ENABLE - /* this magic number is derived from observation */ - if ((st & TIME_SET) != 0 && - (session->gpsdata.fix.time!=session->driver.nmea.last_fixtime)) { - /* this magic number is derived from observation */ - /* GPS-18/USB -> 0.100 */ - /* GPS-18/LVC at 19200 -> 0.125 */ - /* GPS-18/LVC at 4800 -> 0.525*/ - /* Rob Jensen reports 0.675 */ - (void)ntpshm_put(session, session->gpsdata.fix.time + 0.400); - session->driver.nmea.last_fixtime = session->gpsdata.fix.time; - } -#endif /* NTPSHM_ENABLE */ return st; } else return 0; @@ -147,6 +147,7 @@ struct gps_device_t { double poll_times[FD_SETSIZE]; /* last daemon poll time */ #ifdef NTPSHM_ENABLE int shmTime; + double last_fixtime; /* so updates happen once */ # ifdef PPS_ENABLE int shmTimeP; # endif /* PPS_ENABLE */ @@ -164,9 +165,6 @@ struct gps_device_t { int part, await; /* for tracking GSV parts */ struct tm date; double subseconds; -# ifdef NTPSHM_ENABLE - double last_fixtime; /* so updates happen once */ -# endif /* NTPSHM_ENABLE */ } nmea; #endif /* NMEA_ENABLE */ #ifdef BINARY_ENABLE diff --git a/libgpsd_core.c b/libgpsd_core.c index fcc72b51..fb9323fa 100644 --- a/libgpsd_core.c +++ b/libgpsd_core.c @@ -618,6 +618,20 @@ gps_mask_t gpsd_poll(struct gps_device_t *session) else received = 0; /* it was all done in the packet getter */ +#ifdef NTPSHM_ENABLE + /* this magic number is derived from observation */ + if ((received & TIME_SET) != 0 && + (session->gpsdata.fix.time!=session->last_fixtime)) { + /* this magic number is derived from observation */ + /* GPS-18/USB -> 0.100 */ + /* GPS-18/LVC at 19200 -> 0.125 */ + /* GPS-18/LVC at 4800 -> 0.525*/ + /* Rob Jensen reports 0.675 */ + (void)ntpshm_put(session, session->gpsdata.fix.time + 0.400); + session->last_fixtime = session->gpsdata.fix.time; + } +#endif /* NTPSHM_ENABLE */ + /* * Compute fix-quality data from the satellite positions. * This may be overridden by DOPs reported from the packet we just got. |