update hardware clock

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Dear List,

I write the rtc module for a PPC driven machine. I wanted to update the 
RTC clock when I adjusted the system clock to an external source (ISDN 
line). I adjust the time by adjtimex, ADJ_OFFSET_SINGLESHOT. It is working 
nicely.

When I tried to switch on the built in possibility to update the hardware 
clock ("11 minute mode") I was surpriced. It did not updated it in every 
11 minutes only once (sometimes none). I switched on the automatic update 
the following way:

txc.modes = 0;
adjtimex(&txc);
txc.modes = ADJ_STATUS;
txc.status &= ~STA_UNSYNC;
adjtimex(&txc);

But this does not really work. :-(

It is mentioned in the man hwclock(8) that I have to turn this feature on:

>>>>>>>>>>>>>>>>> man hwclock(8) >>>>>>>>>>>>>>>>>>>
...
Automatic Hardware Clock Synchronization By the Kernel
       You should be aware of another way that the Hardware Clock
       is  kept  synchronized  in some systems.  The Linux kernel
       has a mode wherein it copies the System Time to the  Hard­
       ware  Clock  every 11 minutes.  This is a good mode to use
       when you are using something  sophisticated  like  ntp  to
       keep  your System Time synchronized. (ntp is a way to keep
       your System Time synchronized  either  to  a  time  server
       somewhere  on the network or to a radio clock hooked up to
       your system.  See RFC 1305).

       This mode (we'll call it "11 minute mode")  is  off  until
       something  turns it on.  The ntp daemon xntpd is one thing
       that turns it on.  You can turn it  off  by  running  any­
       thing,  including  hwclock --hctosys, that sets the System
       Time the old fashioned way.
...
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

Unfortunatelly it seems that in the file kernel/timer.c the 
second_overflow function swithces off this feature very often.

>>>>>>>>>>>>>> kernel/timer.c >>>>>>>>>>>>>>>>>>>
...
static void second_overflow(void)
{
    long ltemp;

    /* Bump the maxerror field */
    time_maxerror += time_tolerance >> SHIFT_USEC;
    if ( time_maxerror > NTP_PHASE_LIMIT ) {
        time_maxerror = NTP_PHASE_LIMIT;
        time_status |= STA_UNSYNC;
    }
...
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

As the time_maxerror is set to NTP_PHASE_LIMIT, it will be true and set 
the STA_UNSYNC bit.

How can I keep the "11 minute mode" working??? Setting time_tolerance to 0 
is too weird to me.

What should I do???

TIA && Good byte!
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux