diff options
author | Otto Moerbeek <otto@cvs.openbsd.org> | 2007-01-14 19:18:13 +0000 |
---|---|---|
committer | Otto Moerbeek <otto@cvs.openbsd.org> | 2007-01-14 19:18:13 +0000 |
commit | 1379c813c6ce049790e8af02e9034a95cc815ac9 (patch) | |
tree | cb61c6fa3da5255ef64ad03dd0555ed65840ca7a /usr.sbin | |
parent | 6b427a1c06831ec7836cc87364d355c019037b1a (diff) |
Add some comments on the expresssion which converts sensor timedeltas
to ntp offsets; also, rewrite the expression to make it more clear
with no change in semantics. ok henning@
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/ntpd/sensors.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/usr.sbin/ntpd/sensors.c b/usr.sbin/ntpd/sensors.c index 7057220e4ce..0216667163c 100644 --- a/usr.sbin/ntpd/sensors.c +++ b/usr.sbin/ntpd/sensors.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sensors.c,v 1.28 2006/12/28 00:24:27 naddy Exp $ */ +/* $OpenBSD: sensors.c,v 1.29 2007/01/14 19:18:12 otto Exp $ */ /* * Copyright (c) 2006 Henning Brauer <henning@openbsd.org> @@ -164,8 +164,13 @@ sensor_query(struct ntp_sensor *s) s->last = sensor.tv.tv_sec; memcpy(&refid, "HARD", sizeof(refid)); - s->offsets[s->shift].offset = (0 - (float)sensor.value / 1000000000.0) - - getoffset(); + /* + * TD = device time + * TS = system time + * sensor.value = TS - TD in ns + * if value is positive, system time is ahead + */ + s->offsets[s->shift].offset = (sensor.value / -1e9) - getoffset(); s->offsets[s->shift].rcvd = sensor.tv.tv_sec; s->offsets[s->shift].good = 1; |