summaryrefslogtreecommitdiff
path: root/gpsmon.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2015-03-07 09:34:25 -0500
committerEric S. Raymond <esr@thyrsus.com>2015-03-07 09:34:25 -0500
commit4493a8b6eb6a2213f283bd13a0f1cebc072dc9d4 (patch)
tree74114bfc3140c9ed5bbcf21bd56a7f64556eeb7d /gpsmon.c
parenta08a5e6f15f37e3656872751796b6155913fbb6b (diff)
downloadgpsd-4493a8b6eb6a2213f283bd13a0f1cebc072dc9d4.tar.gz
Factor PPS-related members of struct gps_device_t into a pps_thread_t structure.
No logic changes, though it looks like there are two because two guards that would always have failed when the code was compiled with pps=off are now conditioned out. Also, this code is offset-preserving so as not to break link-time compatibility of libgpsd. (This is the subtler approach...) All regression tests pass.
Diffstat (limited to 'gpsmon.c')
-rw-r--r--gpsmon.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/gpsmon.c b/gpsmon.c
index 04739324..fc8b733a 100644
--- a/gpsmon.c
+++ b/gpsmon.c
@@ -790,9 +790,9 @@ static void gpsmon_hook(struct gps_device_t *device, gps_mask_t changed UNUSED)
"------------------- PPS offset: %.20s ------\n ",
timedelta_str);
/* coverity[missing_lock] */
- session.ppslast = noclobber.pps;
+ session.pps_thread.ppsout_last = noclobber.pps;
/* coverity[missing_lock] */
- session.ppscount++;
+ session.pps_thread.ppsout_count++;
}
}
else
@@ -847,8 +847,10 @@ static void gpsmon_hook(struct gps_device_t *device, gps_mask_t changed UNUSED)
* and it is a new second. */
if ( 0 != isnan(device->newdata.time)) {
// "NTP: bad new time
- } else if (device->newdata.time == device->last_fixtime.real) {
+#ifdef PPS_ENABLE
+ } else if (device->newdata.time == device->pps_thread.fixin_real) {
// "NTP: Not a new time
+#endif /* PPS_ENABLE */
} else
ntp_latch(device, &time_offset);
#endif /* NTP_ENABLE */
@@ -1316,7 +1318,7 @@ int main(int argc, char **argv)
/* this guard suppresses a warning on Bluetooth devices */
if (session.sourcetype == source_rs232 || session.sourcetype == source_usb) {
- session.thread_report_hook = pps_report;
+ session.pps_thread.report_hook = pps_report;
pps_thread_activate(&session);
}
#endif /* PPS_ENABLE */