What is the largest hardware clock update the Linux kernel "11-minute mode" can make?
When certain time-related programs (like ntpd
) are running on a Linux system, the kernel will switch into so-called "eleven minute mode" (see the hwclock
man page) whereby it will automatically update the hardware clock from the system clock every eleven minutes.
On SLES11 I have empirically determined that if I set the hardware clock to be something like 10 hours behind the system clock, 11-minute mode seems incapable of making the hardware clock match the system clock. But if I set the hardware clock 5 minutes behind the system clock, 11-minute mode makes a perfect match.
So apparently there's some maximum update that 11-minute mode can handle and I'm wondering what it is.
Update:
This is weird...
More experimentation shows that when I have the HW clock around 20 minutes behind the system clock the 11-minute mode will set the HW clock to be exactly 30 minutes behind the system clock (!):
# date
Tue Dec 6 10:16:52 EST 2011
# hwclock --set --date "12/6/11 09:56"
#
# date
Tue Dec 6 10:17:16 EST 2011
# hwclock --show
Tue Dec 6 09:56:06 2011 -0.156551 seconds
#
# date
Tue Dec 6 10:23:09 EST 2011
# hwclock --show
Tue Dec 6 10:01:58 2011 -0.535772 seconds
#
# date
Tue Dec 6 10:34:28 EST 2011
# hwclock --show
Tue Dec 6 10:04:27 2011 -0.192025 seconds
Update:
I ran across this: https://bugs.archlinux.org/task/27408 which does imply that for good or bad the kernel will not update the hardware clock when the hardware clock time is too far off from the system clock time.
From the hwclock
man page on RHEL 4.6:
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 fashioned 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.
So by the virtue of you running hwclock --set
you have likely turned it off. By the same token you can check the output of the adjtimex --print
to confirm.
In fact this has nothing to do with eleven-minute-mode in kernel. This is related to a feature in ntpd.
Are you aware of so-called sanity limit of ntp? If the time is too far away (for example 10 hours) ntpd gives up and doesn't skew the clock. In those cases, ntpd or ntpdate should be run manually. Ntpd option of -g
should do that. Check information from the man page:
http://doc.ntp.org/4.1.0/ntpd.htm