diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2014-08-22 16:14:39 -0400 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2014-08-22 16:15:43 -0400 |
commit | e6d622fabf16b0ca90b18c8b30bfcf95bd2bf3af (patch) | |
tree | f6df2c5d43d3b0a49c8264fdf965bd05140fc40c /gpsd.c | |
parent | d1a9c349f3b868d52f015361ccf1cb2fad42e282 (diff) | |
download | gpsd-e6d622fabf16b0ca90b18c8b30bfcf95bd2bf3af.tar.gz |
Re-integrate Miroslav's support for large PPS offsets.
The factoring on this could use some cleanup.
All regression tests pass. PPS is live in both gpsd and gpsmon.
Diffstat (limited to 'gpsd.c')
-rw-r--r-- | gpsd.c | 26 |
1 files changed, 2 insertions, 24 deletions
@@ -1562,38 +1562,16 @@ static void all_reports(struct gps_device_t *device, gps_mask_t changed) //gpsd_report(context.debug, LOG_PROG, "NTP: No time this packet\n"); } else if (isnan(device->newdata.time)) { //gpsd_report(context.debug, LOG_PROG, "NTP: bad new time\n"); - } else if (device->newdata.time == device->last_fixtime) { + } else if (device->newdata.time == device->last_fixtime.real) { //gpsd_report(context.debug, LOG_PROG, "NTP: Not a new time\n"); } else if (!device->ship_to_ntpd) { //gpsd_report(context.debug, LOG_PROG, "NTP: No precision time report\n"); } else { - double fix_time, integral, fractional; struct timedrift_t td; - -#ifdef HAVE_CLOCK_GETTIME - /*@i2@*/(void)clock_gettime(CLOCK_REALTIME, &td.clock); -#else - struct timeval clock_tv; - (void)gettimeofday(&clock_tv, NULL); - TVTOTS(&td.clock, &clock_tv); -#endif /* HAVE_CLOCK_GETTIME */ - fix_time = device->newdata.time; - /* assume zero when there's no offset method */ - if (device->device_type == NULL - || device->device_type->time_offset == NULL) - fix_time += 0.0; - else - fix_time += device->device_type->time_offset(device); - /* it's ugly but timestamp_t is double */ - fractional = modf(fix_time, &integral); - /*@-type@*/ /* splint is confused about struct timespec */ - td.real.tv_sec = (time_t)integral; - td.real.tv_nsec = (long)(fractional * 1e+9); - /*@+type@*/ + ntpshm_latch(device, &td); /*@-compdef@*/ (void)ntpshm_put(device, device->shmIndex, &td); /*@+compdef@*/ - device->last_fixtime = device->newdata.time; } #endif /* NTPSHM_ENABLE */ |