Home > IT Architecture, Kernel, Linux, Systems > hwclock and 11 minute mode in linux

hwclock and 11 minute mode in linux

May 28th, 2013

From manpage of hwclock:

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 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 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.

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.

To test whether 11 minutes mode is on or not, you can use the following script(yum install adjtimex first!):

[root@centos-doxer ~]# cat 11minmode
#!/bin/bash

adjtimex --print | awk '/status/ {
if ( and($2, 64) == 0 ) {
print "11 minute mode is enabled"
} else {
print "11 minute mode is disabled"
}
}'

Actually, we better use ntp to do time syncing on OS, and then sync system time to hardware time using hwclock --systohc in cron job to do the time syncing between OS & hardware.

Good Luck!


Categories: IT Architecture, Kernel, Linux, Systems Tags:
Comments are closed.