From 51e14636f6dcf378efdf304a95045c65b1ea9266 Mon Sep 17 00:00:00 2001 From: ckuethe <> Date: Fri, 16 May 2008 06:13:25 +0000 Subject: [PATCH] Allow ntpd to step the time at startup, now matter how large or small the offset. The 180s limit doesn't help very much these days. ok otto@ mbalmer@ --- src/usr.sbin/ntpd/ntpd.8 | 7 +++---- src/usr.sbin/ntpd/ntpd.c | 6 +----- src/usr.sbin/ntpd/ntpd.h | 3 +-- 3 files changed, 5 insertions(+), 11 deletions(-) diff --git a/src/usr.sbin/ntpd/ntpd.8 b/src/usr.sbin/ntpd/ntpd.8 index e7dcf13e..73d766b8 100644 --- a/src/usr.sbin/ntpd/ntpd.8 +++ b/src/usr.sbin/ntpd/ntpd.8 @@ -1,4 +1,4 @@ -.\" $OpenBSD: ntpd.8,v 1.23 2007/12/11 11:26:27 jmc Exp $ +.\" $OpenBSD: ntpd.8,v 1.24 2008/05/16 06:13:24 ckuethe Exp $ .\" .\" Copyright (c) 2003, 2004, 2006 Henning Brauer .\" @@ -14,7 +14,7 @@ .\" AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT .\" OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd $Mdocdate: December 11 2007 $ +.Dd $Mdocdate: May 16 2008 $ .Dt NTPD 8 .Os .Sh NAME @@ -60,8 +60,7 @@ Only check the configuration file for validity. Do not set the time immediately at startup. This is the default. .It Fl s -Set the time immediately at startup if the local clock is off by more -than 180 seconds. +Set the time immediately at startup. Allows for a large time correction, eliminating the need to run .Xr rdate 8 diff --git a/src/usr.sbin/ntpd/ntpd.c b/src/usr.sbin/ntpd/ntpd.c index 9cfbc2b1..89012f4c 100644 --- a/src/usr.sbin/ntpd/ntpd.c +++ b/src/usr.sbin/ntpd/ntpd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ntpd.c,v 1.59 2008/05/14 09:32:18 pyr Exp $ */ +/* $OpenBSD: ntpd.c,v 1.60 2008/05/16 06:13:25 ckuethe Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer @@ -411,10 +411,6 @@ ntpd_settime(double d) char buf[80]; time_t tval; - /* if the offset is small, don't call settimeofday */ - if (d < SETTIME_MIN_OFFSET && d > -SETTIME_MIN_OFFSET) - return; - if (gettimeofday(&curtime, NULL) == -1) { log_warn("gettimeofday"); return; diff --git a/src/usr.sbin/ntpd/ntpd.h b/src/usr.sbin/ntpd/ntpd.h index 323ca05e..2c076fa7 100644 --- a/src/usr.sbin/ntpd/ntpd.h +++ b/src/usr.sbin/ntpd/ntpd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ntpd.h,v 1.91 2008/01/28 11:45:59 mpf Exp $ */ +/* $OpenBSD: ntpd.h,v 1.92 2008/05/16 06:13:25 ckuethe Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer @@ -54,7 +54,6 @@ #define QUERYTIME_MAX 15 /* single query might take n secs max */ #define OFFSET_ARRAY_SIZE 8 #define SENSOR_OFFSETS 7 -#define SETTIME_MIN_OFFSET 180 /* min offset for settime at start */ #define SETTIME_TIMEOUT 15 /* max seconds to wait with -s */ #define LOG_NEGLIGEE 32 /* negligible drift to not log (ms) */ #define FREQUENCY_SAMPLES 8 /* samples for est. of permanent drift */