linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kurt Roeckx <Q@ping.be>
To: Riley Williams <rhw@MemAlpha.cx>
Cc: Alex Bligh - linux-kernel <linux-kernel@alex.org.uk>,
	Linux Kernel <linux-kernel@vger.kernel.org>
Subject: Re: PROBLEM: Linux updates RTC secretly when clock synchronizes
Date: Sat, 3 Nov 2001 22:04:35 +0100	[thread overview]
Message-ID: <20011103220435.A11159@ping.be> (raw)
In-Reply-To: <506556532.1004787679@[195.224.237.69]> <Pine.LNX.4.21.0111031813390.9415-100000@Consulate.UFP.CX>
In-Reply-To: <Pine.LNX.4.21.0111031813390.9415-100000@Consulate.UFP.CX>; from rhw@MemAlpha.cx on Sat, Nov 03, 2001 at 06:35:44PM +0000

On Sat, Nov 03, 2001 at 06:35:44PM +0000, Riley Williams wrote:
> server	127.127.1.0		# local clock
> fudge	127.127.1.0 stratum 10	
> 
> The second server line specifies 127.127.1.0 which is the address that
> ntp associates with the local RTC clock.

>From refclock_local:
 * This is a hack to allow a machine to use its own system clock as a
 * reference clock

This just calls gettimeofday() indirectly.

It's the system clock, not the RTC.  Afaik, there is no support
for the RTC clock.

> >>  2. My experience with the xntpd driver suggests that if no better
> >>     reference is available and the RTC is one of the listed clocks,
> >>     then it ALWAYS adjusts the time to match the RTC, irrespective
> >>     of the time difference between them.
> 
> > ... you are assuming that the RTC doesn't get adjusted first (to
> > match the system clock)!
> 
> If it does, what adjusts it?

ntpd asks the kernel to write the time to the RTC.  I think it
does that from the moment it's sycnhed.  If it would be reading
and writing to the RTC, you could have a problem.

> >>  3. AFAICT, if xntpd writes to the RTC, then it has achieved true
> >>     synchronisation to a reference clock other than the RTC.
> 
> > I thought the original poster was claiming that the /kernel/
> > wrote to the RTC, which would explain the behaviour I'm seeing.
> 
> The kernel itself never writes to the RTC, and that is one of Linus's
> decisions with which I am in 100% agreeance (and one thing I hate about
> Windows). In fact, the kernel itself also doesn't read from the RTC
> either, but leaves that to userspace.

The kernel does write to the RTC if told to do so, every 11
minutes.  This is broken because it doesn't even know what hour
it should be writing, so it doesn't write it.

In arch/i386/kernel/time.c/do_timer_interrupt():

        /*
         * If we have an externally synchronized Linux clock, then update
         * CMOS clock accordingly every ~11 minutes. Set_rtc_mmss() has to be
         * called as close as possible to 500 ms before the new second starts.
         */
        if ((time_status & STA_UNSYNC) == 0 &&
            xtime.tv_sec > last_rtc_update + 660 &&
            xtime.tv_usec >= 500000 - ((unsigned) tick) / 2 &&
            xtime.tv_usec <= 500000 + ((unsigned) tick) / 2) {
                if (set_rtc_mmss(xtime.tv_sec) == 0)
                        last_rtc_update = xtime.tv_sec;
                else
                        last_rtc_update = xtime.tv_sec - 600; /* do it again in
60 s */
        }

Kurt


  parent reply	other threads:[~2001-11-03 22:04 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
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 [this message]
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=20011103220435.A11159@ping.be \
    --to=q@ping.be \
    --cc=linux-kernel@alex.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rhw@MemAlpha.cx \
    /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;
as well as URLs for NNTP newsgroup(s).