From 45a03a18d606b0d6a7993293c8b654447e01d906 Mon Sep 17 00:00:00 2001 From: otto <> Date: Mon, 26 Jun 2006 09:43:06 +0000 Subject: [PATCH] increase polling intervbal, but only after we are synced and have done a few frequency adjustments. ok henning@ --- src/usr.sbin/ntpd/ntp.c | 7 +++++-- src/usr.sbin/ntpd/ntpd.h | 7 ++++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/usr.sbin/ntpd/ntp.c b/src/usr.sbin/ntpd/ntp.c index 631a1a8e..c38ef284 100644 --- a/src/usr.sbin/ntpd/ntp.c +++ b/src/usr.sbin/ntpd/ntp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ntp.c,v 1.88 2006/06/21 07:42:00 otto Exp $ */ +/* $OpenBSD: ntp.c,v 1.89 2006/06/26 09:43:06 otto Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer @@ -151,6 +151,7 @@ ntp_main(int pipe_prnt[2], struct ntpd_conf *nconf) bzero(&conf->status, sizeof(conf->status)); + conf->freq.num = 0; conf->freq.samples = 0; conf->freq.x = 0.0; conf->freq.xx = 0.0; @@ -479,6 +480,7 @@ priv_adjfreq(double offset) conf->freq.xx = 0.0; conf->freq.samples = 0; conf->freq.overall_offset = 0.0; + conf->freq.num++; } int @@ -613,7 +615,8 @@ update_scale(double offset) if (offset < 0) offset = -offset; - if (offset > QSCALE_OFF_MAX) + if (offset > QSCALE_OFF_MAX || !conf->status.synced || + conf->freq.num < 3) conf->scale = 1; else if (offset < QSCALE_OFF_MIN) conf->scale = QSCALE_OFF_MAX / QSCALE_OFF_MIN; diff --git a/src/usr.sbin/ntpd/ntpd.h b/src/usr.sbin/ntpd/ntpd.h index f2a196af..3380ea62 100644 --- a/src/usr.sbin/ntpd/ntpd.h +++ b/src/usr.sbin/ntpd/ntpd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ntpd.h,v 1.74 2006/06/22 11:11:25 otto Exp $ */ +/* $OpenBSD: ntpd.h,v 1.75 2006/06/26 09:43:06 otto Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer @@ -50,8 +50,8 @@ #define MAX_SERVERS_DNS 8 -#define QSCALE_OFF_MIN 0.05 -#define QSCALE_OFF_MAX 0.50 +#define QSCALE_OFF_MIN 0.001 +#define QSCALE_OFF_MAX 0.050 #define QUERYTIME_MAX 15 /* single query might take n secs max */ #define OFFSET_ARRAY_SIZE 8 @@ -152,6 +152,7 @@ struct ntp_freq { double x, y; double xx, xy; int samples; + u_int num; }; struct ntpd_conf {