From: Kurt Roeckx <Q@ping.be>
To: Ian Maclaine-cross <iml@ilm.mech.unsw.edu.au>
Cc: linux-kernel@vger.kernel.org, Ian Maclaine-cross <iml@debian.org>
Subject: Re: PROBLEM: Linux updates RTC secretly when clock synchronizes
Date: Wed, 31 Oct 2001 12:52:05 +0100 [thread overview]
Message-ID: <20011031125204.A1126@ping.be> (raw)
In-Reply-To: <20011031113312.A8738@ilm.mech.unsw.edu.au> <20011031020538.A354@ping.be> <20011031135507.A9129@ilm.mech.unsw.edu.au>
In-Reply-To: <20011031135507.A9129@ilm.mech.unsw.edu.au>; from iml@ilm.mech.unsw.edu.au on Wed, Oct 31, 2001 at 01:55:07PM +1100
On Wed, Oct 31, 2001 at 01:55:07PM +1100, Ian Maclaine-cross wrote:
> On Wed, Oct 31, 2001 at 02:05:38AM +0100, Kurt Roeckx wrote:
> > On Wed, Oct 31, 2001 at 11:33:12AM +1100, Ian Maclaine-cross wrote:
> > >
> > > PROBLEM: Linux updates RTC secretly when clock synchronizes.
> > >
> > > When /usr/sbin/ntpd synchronizes the Linux kernel (or system) clock
> > > using the Network Time Protocol the kernel time is accurate to a few
> > > milliseconds. Linux then sets the Real Time (or Hardware or CMOS)
> > > Clock to this time at approximately 11 minute intervals. Typical RTCs
> > > drift less than 10 s/day so rebooting causes only millisecond errors.
>
> When the machine reboots from a power interruption Internet connection
> may be unavailable (usual here). Ntpd can start synchronized to an RTC
> but time is inaccurate because hwclock has not adjusted it. When
> Internet connection reestablishes ntpd notices the time conflict and
> terminates. Human intervention or cron lines can run ntpdate and then
> restart ntpd. This results in time of low quality.
I'm not really sure about this, but I think you need a *high*
offset, like in the order of an hour, before ntpd refused to
adjust. I know it happely does 5 minutes.
> There are lots of high quality and cost hardware solutions. The
> solution in my first post was a very small kernel patch to add an
> 11 minute update log so hwclock etc could adjust the time. Any
> comments on my patch?
Note that hwclock does not adjust the clock if the error is
smaller than 1 second, or it already wrote to the RTC is the past
23 hours.
It would only help if your box was down for more then a day. In
that case it probably also drifted for more then a second.
I don't know how to set up ntpd to synch to the RTC clock, but I
doubt it would take the drift it has into account.
Also note that in case the kernel writes the time to the RTC
clock, hwclock can't calculate the drift it has properly because
it is calculated the time it writes to the RTC.
What you probably want to do is disable the kernel writing the
time to the RTC, and let hwclock do write the time to the RTC so
it can calculate the drift properly, and adjust for it during
startup.
Ntpd will also adjust the frequency of the system clock, and you
should get a reasonable accurate time.
Btw: Last time I looked at it (util-linux-2.11h), the calculation
of the driftfactor in hwclock was still pretty inaccurate. I
once did send patch for it, but it doesn't seem to be included.
There also is an adjtime.patch included you could use.
Kurt
next prev parent reply other threads:[~2001-10-31 11:52 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-10-31 0:33 PROBLEM: Linux updates RTC secretly when clock synchronizes Ian Maclaine-cross
2001-10-31 1:05 ` Kurt Roeckx
2001-10-31 2:55 ` Ian Maclaine-cross
2001-10-31 11:52 ` Kurt Roeckx [this message]
2001-11-01 0:52 ` Riley Williams
2001-11-01 1:26 ` Kurt Roeckx
2001-11-01 13:57 ` Alex Bligh - linux-kernel
2001-11-02 9:50 ` Riley Williams
2001-11-03 11:41 ` Alex Bligh - linux-kernel
2001-11-03 18:35 ` Riley Williams
2001-11-03 19:19 ` Alex Bligh - linux-kernel
2001-11-03 21:04 ` Kurt Roeckx
2001-11-06 10:01 ` Pavel Machek
2001-11-06 9:57 ` Pavel Machek
2001-11-02 12:16 ` Pavel Machek
2001-11-05 23:08 ` Riley Williams
2001-11-06 10:17 ` Pavel Machek
2001-11-07 0:00 ` Riley Williams
2001-11-07 0:44 ` Alex Bligh - linux-kernel
2001-11-07 1:01 ` Kurt Roeckx
2001-11-07 1:15 ` Alex Bligh - linux-kernel
2001-11-07 9:24 ` Russell King
2001-11-08 12:26 ` Pavel Machek
2001-11-08 23:00 ` Riley Williams
2001-11-09 9:32 ` Pavel Machek
2001-11-09 21:11 ` Riley Williams
2001-11-09 21:30 ` Pavel Machek
2001-11-09 22:54 ` Riley Williams
2001-11-09 23:10 ` Mark Zealey
2001-11-10 20:04 ` Pavel Machek
2001-11-10 20:35 ` Riley Williams
2001-11-10 20:43 ` Pavel Machek
2001-11-10 20:49 ` Doug McNaught
2001-11-06 0:20 ` Ian Maclaine-cross
2001-11-06 10:18 ` Pavel Machek
2001-11-08 5:09 ` Ian Maclaine-cross
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20011031125204.A1126@ping.be \
--to=q@ping.be \
--cc=iml@debian.org \
--cc=iml@ilm.mech.unsw.edu.au \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox