From 3266f15dd72618d8a4af1896a9b838a5d750337a Mon Sep 17 00:00:00 2001 From: henning <> Date: Fri, 9 Jul 2004 15:00:43 +0000 Subject: [PATCH] don't try to update the clock when we have no data --- src/usr.sbin/ntpd/ntp.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/usr.sbin/ntpd/ntp.c b/src/usr.sbin/ntpd/ntp.c index 6bf01eac..fe3ef683 100644 --- a/src/usr.sbin/ntpd/ntp.c +++ b/src/usr.sbin/ntpd/ntp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ntp.c,v 1.20 2004/07/09 12:21:09 henning Exp $ */ +/* $OpenBSD: ntp.c,v 1.21 2004/07/09 15:00:43 henning Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer @@ -287,10 +287,11 @@ ntp_adjtime(struct ntpd_conf *conf) offset_cnt++; } - offset_median /= offset_cnt; - - imsg_compose(&ibuf_main, IMSG_ADJTIME, 0, + if (offset_cnt > 0) { + offset_median /= offset_cnt; + imsg_compose(&ibuf_main, IMSG_ADJTIME, 0, &offset_median, sizeof(offset_median)); + } } int