Browse Source

with usig the meadian offset froma number of measurements the recording

of the last sensor update time got broken, doesn't show up with gps since
it updates often (more often than we read), but naddy ran into it with dcf.
record time of last sensor datum seperately. ok naddy balmer
OPENBSD_4_1
henning 18 years ago
parent
commit
a4d68a0292
2 changed files with 5 additions and 3 deletions
  1. +2
    -1
      src/usr.sbin/ntpd/ntpd.h
  2. +3
    -2
      src/usr.sbin/ntpd/sensors.c

+ 2
- 1
src/usr.sbin/ntpd/ntpd.h View File

@ -1,4 +1,4 @@
/* $OpenBSD: ntpd.h,v 1.78 2006/10/27 12:22:41 henning Exp $ */
/* $OpenBSD: ntpd.h,v 1.79 2006/11/20 20:58:47 henning Exp $ */
/* /*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@ -138,6 +138,7 @@ struct ntp_sensor {
struct ntp_offset offsets[SENSOR_OFFSETS]; struct ntp_offset offsets[SENSOR_OFFSETS];
struct ntp_offset update; struct ntp_offset update;
time_t next; time_t next;
time_t last;
char *device; char *device;
int sensorid; int sensorid;
u_int8_t weight; u_int8_t weight;


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

@ -1,4 +1,4 @@
/* $OpenBSD: sensors.c,v 1.25 2006/10/27 12:22:41 henning Exp $ */
/* $OpenBSD: sensors.c,v 1.26 2006/11/20 20:58:47 henning Exp $ */
/* /*
* Copyright (c) 2006 Henning Brauer <henning@openbsd.org> * Copyright (c) 2006 Henning Brauer <henning@openbsd.org>
@ -156,9 +156,10 @@ sensor_query(struct ntp_sensor *s)
return; return;
} }
if (sensor.tv.tv_sec == s->update.rcvd) /* already seen */
if (sensor.tv.tv_sec == s->last) /* already seen */
return; return;
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) - s->offsets[s->shift].offset = (0 - (float)sensor.value / 1000000000.0) -
getoffset(); getoffset();


Loading…
Cancel
Save