summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOtto Moerbeek <otto@cvs.openbsd.org>2006-06-26 09:43:07 +0000
committerOtto Moerbeek <otto@cvs.openbsd.org>2006-06-26 09:43:07 +0000
commit18452fcadf0b5488f3a6fded4f384c166ef62f2a (patch)
tree0a6738455330d7608b8f840f0926041eacfee629
parent9abd639bf8257142a2ac7b7ca00dc39667ec858a (diff)
increase polling intervbal, but only after we are synced and have done
a few frequency adjustments. ok henning@
-rw-r--r--usr.sbin/ntpd/ntp.c7
-rw-r--r--usr.sbin/ntpd/ntpd.h7
2 files changed, 9 insertions, 5 deletions
diff --git a/usr.sbin/ntpd/ntp.c b/usr.sbin/ntpd/ntp.c
index 631a1a8eda3..c38ef284ecc 100644
--- a/usr.sbin/ntpd/ntp.c
+++ b/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 <henning@openbsd.org>
@@ -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/usr.sbin/ntpd/ntpd.h b/usr.sbin/ntpd/ntpd.h
index f2a196af534..3380ea6263f 100644
--- a/usr.sbin/ntpd/ntpd.h
+++ b/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 <henning@openbsd.org>
@@ -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 {