Browse Source

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@
OPENBSD_4_1
otto 18 years ago
parent
commit
7690556ff8
1 changed files with 8 additions and 3 deletions
  1. +8
    -3
      src/usr.sbin/ntpd/sensors.c

+ 8
- 3
src/usr.sbin/ntpd/sensors.c View File

@ -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> * Copyright (c) 2006 Henning Brauer <henning@openbsd.org>
@ -164,8 +164,13 @@ sensor_query(struct ntp_sensor *s)
s->last = sensor.tv.tv_sec; s->last = sensor.tv.tv_sec;
memcpy(&refid, "HARD", sizeof(refid)); 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].rcvd = sensor.tv.tv_sec;
s->offsets[s->shift].good = 1; s->offsets[s->shift].good = 1;


Loading…
Cancel
Save