summaryrefslogtreecommitdiff
path: root/ntpshm.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2013-11-06 11:36:14 -0500
committerEric S. Raymond <esr@thyrsus.com>2013-11-06 11:36:14 -0500
commitb85c3a67bcbfb65966f40a5e8d4bd66a2966fb6f (patch)
tree5a9a5c74e710c8e07152f4972e36951f1f587ea9 /ntpshm.c
parent8c5e661e42a753e08bae03d533bd4541f5d7d91b (diff)
downloadgpsd-b85c3a67bcbfb65966f40a5e8d4bd66a2966fb6f.tar.gz
Unify time-difference computations. All regression tests pass, PPS is live.
Diffstat (limited to 'ntpshm.c')
-rw-r--r--ntpshm.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/ntpshm.c b/ntpshm.c
index ee70e409..a82fbd24 100644
--- a/ntpshm.c
+++ b/ntpshm.c
@@ -353,8 +353,7 @@ static void chrony_send(struct gps_device_t *session, struct timedrift_t *td)
/*@-type@*//* splint is confused about struct timespec */
TSTOTV(&sample.tv, &td->real);
/*@-compdef@*/
- sample.offset = td->real.tv_sec - td->clock.tv_sec;
- sample.offset += (td->real.tv_nsec - td->clock.tv_nsec) / 1e9;
+ sample.offset = timespec_diff_ns(td->real, td->clock) / 1e9;
/*@+compdef@*/
/*@+type@*/