Browse Source

increase polling intervbal, but only after we are synced and have done

a few frequency adjustments. ok henning@
OPENBSD_4_0
otto 18 years ago
parent
commit
45a03a18d6
2 changed files with 9 additions and 5 deletions
  1. +5
    -2
      src/usr.sbin/ntpd/ntp.c
  2. +4
    -3
      src/usr.sbin/ntpd/ntpd.h

+ 5
- 2
src/usr.sbin/ntpd/ntp.c View File

@ -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;


+ 4
- 3
src/usr.sbin/ntpd/ntpd.h View File

@ -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 {


Loading…
Cancel
Save