You are not logged in.

#1 2013-03-18 15:40:37

Atronach
Banned
Registered: 2010-11-13
Posts: 48

[SOLVED] 11 minute mode not active?

Hi,
there's a section in the hwclock man page:

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 Hardware 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 syn‐
       chronized 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 anything, including hwclock --hctosys, that sets the System Time the old fash‐
       ioned way.

       To see if it is on or off, use the command adjtimex --print and look at the value of "status".  If the  "64"  bit  of  this
       number (expressed in binary) equal to 0, 11 minute mode is on.  Otherwise, it is off.

       If  your system runs with 11 minute mode on, don't use hwclock --adjust or hwclock --hctosys.  You'll just make a mess.  It
       is acceptable to use a hwclock --hctosys at startup time to get a reasonable System Time until your system is able  to  set
       the System Time from the external source and start 11 minute mode.

I have ntpd.service enabled:

$ systemctl status ntpd
ntpd.service - Network Time Service
          Loaded: loaded (/usr/lib/systemd/system/ntpd.service; enabled)
          Active: active (running) since Po 2013-03-18 16:19:02 CET; 16min ago
         Process: 547 ExecStart=/usr/bin/ntpd -g -u ntp:ntp (code=exited, status=0/SUCCESS)                                           
        Main PID: 563 (ntpd)                                                                                                          
          CGroup: name=systemd:/system/ntpd.service                                                                                   
                  └─563 /usr/bin/ntpd -g -u ntp:ntp

I haven't put hwclock in any script to interfere with the 11 minute mode, however:

$ adjtimex --print
         mode: 0
       offset: 0
    frequency: 1130430
     maxerror: 16000000
     esterror: 16000000
       status: 65
time_constant: 7
    precision: 1
    tolerance: 32768000
         tick: 10000
     raw time:  1363620399s 961944us = 1363620399.961944
 return value = 5

The status value isn't 64 or 0 as it should be according to the hwclock man page, it's 65 sometimes 8193. So where's the problem blocking the 11 minute mode? Thanks.

Last edited by Atronach (2013-03-20 16:58:32)

Offline

#2 2013-03-18 16:45:16

brebs
Member
Registered: 2007-04-03
Posts: 3,742

Re: [SOLVED] 11 minute mode not active?

Do you have the kernel option:

CONFIG_GENERIC_CMOS_UPDATE=y

People who care about such time-keeping should use hwclock instead, apparently, because the kernel's code doesn't account for drift.

Offline

#3 2013-03-18 17:43:50

Atronach
Banned
Registered: 2010-11-13
Posts: 48

Re: [SOLVED] 11 minute mode not active?

brebs wrote:

Do you have the kernel option:
CONFIG_GENERIC_CMOS_UPDATE=y

yes:

$ zcat /proc/config.gz | grep -i cmos
CONFIG_GENERIC_CMOS_UPDATE=y
CONFIG_RTC_DRV_CMOS=y
brebs wrote:

People who care about such time-keeping should use hwclock instead, apparently, because the kernel's code doesn't account for drift.

...but ntp synchronizes the system time regularly over the internet so the drift isn't so much of a issue or is it? Plus I don't really need extra precise time for tens of µs, I just want to regularly sync the system time over the net (which is provided by ntp) and regularly sync the system time to the hardware clock so the updated time is available to windows on another partition which doesn't do any ntp sync on its own.

Offline

#4 2013-03-20 16:58:14

Atronach
Banned
Registered: 2010-11-13
Posts: 48

Re: [SOLVED] 11 minute mode not active?

Ok, it seems the 8193 status value means the 11 minute mode is active after all. I wonder what the snippet:

..."64"  bit  of  this number (expressed in binary) equal to 0...

from the hwclock man page means then. Perhaps someone could elaborate on it? I tried to change the system time few minutes off and wait a while for ntpd to correct it by syncing from the net and rtc/hw clock reflected the change after some 11 minutes. However it happens so supposedly only when the RTC isn't off by more than 15 minutes which doesn't make it very useful for me. Therefore I'll be using either a hwclock.service or chrony to sync the hw clock.

Last edited by Atronach (2013-03-20 17:30:14)

Offline

Board footer

Powered by FluxBB