summaryrefslogtreecommitdiff
path: root/ntpshm.c
diff options
context:
space:
mode:
authorGary E. Miller <gem@rellim.com>2009-11-18 17:56:45 +0000
committerGary E. Miller <gem@rellim.com>2009-11-18 17:56:45 +0000
commitdcef1303775614710bb676e603947cb4b7bd0e01 (patch)
tree8a4b775f904d97c49bc19cdf5c5cada23ef7e02e /ntpshm.c
parent07c80147d345a8dcdf3d945be9f5c47dd8f3d0f5 (diff)
downloadgpsd-dcef1303775614710bb676e603947cb4b7bd0e01.tar.gz
Fix PPS precision at -16.
ntpd ignores it anyway and it saves a lot of floating point calculation.
Diffstat (limited to 'ntpshm.c')
-rw-r--r--ntpshm.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/ntpshm.c b/ntpshm.c
index 56d5d87a..1f840b19 100644
--- a/ntpshm.c
+++ b/ntpshm.c
@@ -237,17 +237,20 @@ int ntpshm_pps(struct gps_device_t *session, struct timeval *tv)
shmTimeP->clockTimeStampUSec = (int)microseconds;
shmTimeP->receiveTimeStampSec = (time_t)tv->tv_sec;
shmTimeP->receiveTimeStampUSec = (int)tv->tv_usec;
- /* this is more an offset jitter/dispersion than precision,
- * but still useful */
- shmTimeP->precision = offset != 0 ? (int)(ceil(log(offset) / M_LN2)) : -20;
+ /* precision is a placebo, ntpd does not really use it
+ * real world accuracty is around 16uS, thus -16 precision */
+ shmTimeP->precision = -16;
shmTimeP->count++;
shmTimeP->valid = 1;
+ /* this is more an offset jitter/dispersion than precision,
+ * but still useful for debug */
+ precision = offset != 0 ? (int)(ceil(log(offset) / M_LN2)) : -20;
gpsd_report(LOG_RAW
, "PPS ntpshm_pps %lu.%03lu @ %lu.%06lu, precision %d\n"
, (unsigned long)seconds, (unsigned long)microseconds/1000
, (unsigned long)tv->tv_sec, (unsigned long)tv->tv_usec
- , shmTimeP->precision);
+ , precision);
return 1;
}
#endif /* PPS_ENABLE */