diff --git a/src/usr.sbin/ntpd/ntp.c b/src/usr.sbin/ntpd/ntp.c index 6c5e5a4e..c55a333c 100644 --- a/src/usr.sbin/ntpd/ntp.c +++ b/src/usr.sbin/ntpd/ntp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ntp.c,v 1.36 2004/10/13 12:22:39 henning Exp $ */ +/* $OpenBSD: ntp.c,v 1.37 2004/10/13 14:02:50 henning Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer @@ -373,12 +373,18 @@ ntp_adjtime(void) qsort(peers, offset_cnt, sizeof(struct ntp_peer *), offset_compare); if (offset_cnt > 0) { - if (offset_cnt > 1 && offset_cnt % 2 == 0) + if (offset_cnt > 1 && offset_cnt % 2 == 0) { offset_median = (peers[offset_cnt / 2 - 1]->update.offset + peers[offset_cnt / 2]->update.offset) / 2; - else + conf->status.rootdelay = + (peers[offset_cnt / 2 - 1]->update.delay + + peers[offset_cnt / 2]->update.delay) / 2; + } else { offset_median = peers[offset_cnt / 2]->update.offset; + conf->status.rootdelay = + peers[offset_cnt / 2]->update.delay; + } imsg_compose(ibuf_main, IMSG_ADJTIME, 0, 0, &offset_median, sizeof(offset_median)); diff --git a/src/usr.sbin/ntpd/server.c b/src/usr.sbin/ntpd/server.c index 5fb46a3a..28574e6e 100644 --- a/src/usr.sbin/ntpd/server.c +++ b/src/usr.sbin/ntpd/server.c @@ -1,4 +1,4 @@ -/* $OpenBSD: server.c,v 1.14 2004/10/13 12:22:39 henning Exp $ */ +/* $OpenBSD: server.c,v 1.15 2004/10/13 14:02:50 henning Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer @@ -136,6 +136,7 @@ server_dispatch(int fd, struct ntpd_conf *conf) reply.reftime = d_to_lfp(conf->status.reftime); reply.xmttime = d_to_lfp(gettime()); reply.orgtime = query.xmttime; + reply.rootdelay = d_to_sfp(conf->status.rootdelay); if (version > 3) reply.refid = reply.xmttime.fraction;