summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHenning Brauer <henning@cvs.openbsd.org>2005-04-18 14:12:51 +0000
committerHenning Brauer <henning@cvs.openbsd.org>2005-04-18 14:12:51 +0000
commitb98d6583407451ae115a603d873b732bd0bdfc9d (patch)
tree1f9fee9eb766c63714696f504a6c0ccbec834485
parentc18e75f9a186853ac15d48e92f8e9a555e09e8a1 (diff)
correctness: only account for offset after settime in next and deadline
when those timers are actually running. due to the way ntpd's logic works this does not really make a difference, but correctness is good. spotted by me, joerg agrees
-rw-r--r--usr.sbin/ntpd/ntp.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/usr.sbin/ntpd/ntp.c b/usr.sbin/ntpd/ntp.c
index a3deac5dfa4..a082f191fc3 100644
--- a/usr.sbin/ntpd/ntp.c
+++ b/usr.sbin/ntpd/ntp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ntp.c,v 1.56 2005/04/18 11:07:55 henning Exp $ */
+/* $OpenBSD: ntp.c,v 1.57 2005/04/18 14:12:50 henning Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -460,8 +460,10 @@ priv_settime(double offset)
conf->settime = 0;
TAILQ_FOREACH(p, &conf->ntp_peers, entry) {
- p->next -= (time_t)offset;
- p->deadline -= (time_t) offset;
+ if (p->next)
+ p->next -= offset;
+ if (p->deadline)
+ p->deadline -= offset;
}
}