Browse Source

Reset adjtime() on startup; having an adjtime() active while starting

up causes overcompensation and confusing debug log entries; noticed
by dtucker@
OPENBSD_4_0
otto 18 years ago
parent
commit
2e46737551
1 changed files with 14 additions and 1 deletions
  1. +14
    -1
      src/usr.sbin/ntpd/ntpd.c

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

@ -1,4 +1,4 @@
/* $OpenBSD: ntpd.c,v 1.45 2006/06/22 11:11:25 otto Exp $ */
/* $OpenBSD: ntpd.c,v 1.46 2006/06/26 08:10:45 otto Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@ -37,6 +37,7 @@ __dead void usage(void);
int main(int, char *[]);
int check_child(pid_t, const char *);
int dispatch_imsg(struct ntpd_conf *);
void reset_adjtime(void);
int ntpd_adjtime(double);
void ntpd_adjfreq(double);
void ntpd_settime(double);
@ -128,6 +129,7 @@ main(int argc, char *argv[])
}
endpwent();
reset_adjtime();
if (!conf.settime) {
log_init(conf.debug);
if (!conf.debug)
@ -323,6 +325,17 @@ dispatch_imsg(struct ntpd_conf *conf)
return (0);
}
void
reset_adjtime(void)
{
struct timeval tv;
tv.tv_sec = 0;
tv.tv_usec = 0;
if (adjtime(&tv, NULL) == -1)
log_warn("reset adjtime failed");
}
int
ntpd_adjtime(double d)
{


Loading…
Cancel
Save