summaryrefslogtreecommitdiff
path: root/libgpsd_core.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2015-02-10 13:42:29 -0500
committerEric S. Raymond <esr@thyrsus.com>2015-02-10 13:42:29 -0500
commit0231f6359065ba49230051474f977369d5a58e95 (patch)
treeb0bb0f41a5176eed0ea7937d73417b27e86ab363 /libgpsd_core.c
parent029b5e46b08810d0dcf65456edec877c1bda1105 (diff)
downloadgpsd-0231f6359065ba49230051474f977369d5a58e95.tar.gz
Fix the gpsmon display-trashing problem; add some documentation and asserts.
All regression tests pass.
Diffstat (limited to 'libgpsd_core.c')
-rw-r--r--libgpsd_core.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/libgpsd_core.c b/libgpsd_core.c
index e0d605a0..b7316282 100644
--- a/libgpsd_core.c
+++ b/libgpsd_core.c
@@ -1650,6 +1650,9 @@ void ntpshm_latch(struct gps_device_t *device, struct timedrift_t /*@out@*/*td)
{
double fix_time, integral, fractional;
+ /* this should be an invariant of the way this function is called */
+ assert(!isnan(device->newdata.time));
+
#ifdef HAVE_CLOCK_GETTIME
/*@i2@*/(void)clock_gettime(CLOCK_REALTIME, &td->clock);
#else
@@ -1658,10 +1661,6 @@ void ntpshm_latch(struct gps_device_t *device, struct timedrift_t /*@out@*/*td)
TVTOTS(&td->clock, &clock_tv);
#endif /* HAVE_CLOCK_GETTIME */
fix_time = device->newdata.time;
- if ( isnan( device->newdata.time ) ) {
- /* this should not happen, but it does */
- fix_time = 0.0;
- }
/* assume zero when there's no offset method */
if (device->device_type == NULL
|| device->device_type->time_offset == NULL)