Browse Source

log tiny frequency adjustments at debug only.

ok henning@, 'I think I agree' otto@
OPENBSD_4_5
stevesk 16 years ago
parent
commit
75af6f507d
2 changed files with 16 additions and 6 deletions
  1. +14
    -5
      src/usr.sbin/ntpd/ntpd.c
  2. +2
    -1
      src/usr.sbin/ntpd/ntpd.h

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

@ -1,4 +1,4 @@
/* $OpenBSD: ntpd.c,v 1.63 2009/02/06 21:48:00 stevesk Exp $ */
/* $OpenBSD: ntpd.c,v 1.64 2009/02/10 16:52:09 stevesk Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@ -380,6 +380,7 @@ void
ntpd_adjfreq(double relfreq, int wrlog)
{
int64_t curfreq;
double ppmfreq;
int r;
if (adjfreq(NULL, &curfreq) == -1) {
@ -393,10 +394,18 @@ ntpd_adjfreq(double relfreq, int wrlog)
*/
curfreq += relfreq * 1e9 * (1LL << 32);
r = writefreq(curfreq / 1e9 / (1LL << 32));
if (wrlog)
log_info("adjusting clock frequency by %f to %fppm%s",
relfreq * 1e6, curfreq / 1e3 / (1LL << 32),
r ? "" : " (no drift file)");
ppmfreq = relfreq * 1e6;
if (wrlog) {
if (ppmfreq >= LOG_NEGLIGIBLE_ADJFREQ ||
ppmfreq <= -LOG_NEGLIGIBLE_ADJFREQ)
log_info("adjusting clock frequency by %f to %fppm%s",
ppmfreq, curfreq / 1e3 / (1LL << 32),
r ? "" : " (no drift file)");
else
log_debug("adjusting clock frequency by %f to %fppm%s",
ppmfreq, curfreq / 1e3 / (1LL << 32),
r ? "" : " (no drift file)");
}
if (adjfreq(&curfreq, NULL) == -1)
log_warn("adjfreq failed");


+ 2
- 1
src/usr.sbin/ntpd/ntpd.h View File

@ -1,4 +1,4 @@
/* $OpenBSD: ntpd.h,v 1.97 2009/02/06 21:48:00 stevesk Exp $ */
/* $OpenBSD: ntpd.h,v 1.98 2009/02/10 16:52:09 stevesk Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@ -56,6 +56,7 @@
#define SENSOR_OFFSETS 7
#define SETTIME_TIMEOUT 15 /* max seconds to wait with -s */
#define LOG_NEGLIGIBLE_ADJTIME 32 /* negligible drift to not log (ms) */
#define LOG_NEGLIGIBLE_ADJFREQ 0.05 /* negligible rate to not log (ppm) */
#define FREQUENCY_SAMPLES 8 /* samples for est. of permanent drift */
#define MAX_FREQUENCY_ADJUST 128e-5 /* max correction per iteration */
#define REPORT_INTERVAL (24*60*60) /* interval between status reports */


Loading…
Cancel
Save