Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 3 Feb 2005 19:34:20 +0100 (CET)
From:      Oliver Fromme <olli@lurza.secnetix.de>
To:        freebsd-stable@FreeBSD.ORG
Subject:   Re: Adjusting time on a secured FreeBSD machine.
Message-ID:  <200502031834.j13IYKsl050718@lurza.secnetix.de>
In-Reply-To: <200502031803.j13I3NZR016534@the-macgregors.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Rob MacGregor <freebsd.macgregor@blueyonder.co.uk> wrote:
 > Eli K. Breen wrote:
 > > I'm not sure that this will cut it as it will days a very long time to
 > > adjust to the proper time. Is there any way to speed this up?
 > 
 > Not within NTPd itself.  You could go with manually stepping the time in 1s
 > intervals.

Adding to that, the following /bin/sh snippet should do
(untested!).  You have to kill ntpd before.

STEP=100	# number of seconds to step forward
while [ $STEP -gt 0 ]; do
        date -f %s $(( `date +%s` + 1 ))
        sleep 1
        STEP=$(( $STEP - 1 ))
done

It will take about 100 seconds to correct the clock forward
by another 100 seconds.  If you need to correct backwards,
replace "+ 1" by "- 1".  For different numbers of seconds
to correct, replace the 100 in the first line.

When you have approached the correct time sufficiently (i.e.
within a few seconds), restart ntpd with the -x option.

Best regards
   Oliver

-- 
Oliver Fromme, secnetix GmbH & Co KG, Oettingenstr. 2, 80538 München
Any opinions expressed in this message may be personal to the author
and may not necessarily reflect the opinions of secnetix in any way.

"Documentation is like sex; when it's good, it's very, very good,
and when it's bad, it's better than nothing."
        -- Dick Brandon



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200502031834.j13IYKsl050718>