hwclock accuracy

Hal Murray hmurray at megapathdsl.net
Thu Jan 20 05:15:01 EST 2011


> What is the accuracy of the hwclock on XOs? Can we assume that it will keep
> good time over an XO's five-year lifespan?

The ballpark for the hardware is 1 second per day.

> We have some XO-1.5s that have their hwclocks off by 10-20 minutes. Would
> this likely be due to a fault at the factory (e.g. not setting the time
> before shipping them), or did they skew over time? 

How long ago did you last set the clock?

Timekeeping is more complicated than that.

/etc/init.d/halt calls /sbin/hwclock --systohc
So each time you shut down cleanly, your hwclock gets updated with the 
current system time.  That's probably a good idea if you are running ntpd 
like most Linux boxes.

However, if you aren't running ntpd (or somehow keeping the system clock 
reasonably sane), you are swapping the drift on the hwclock for the drift of 
the system clock.

Sometime in the past few years, the timekeeping corner of the kernel was 
cleaned up.  Unfortunately, they introduced a bug in the TSC clock 
calibration code.

The main problem for most Linux users is that it doesn't get the same answer 
each time it boots.  It's close, but not very good if you are interested in 
timekeeping.

If it were consistent, ntpd could easily correct for the error.  That's what 
/var/lib/ntp/drift is for.  (Small variations are expected due to 
temperature.)

The secondary problem is that it's likely to be off by 10s of seconds per 
day.  I'll dig out some numbers if anybody wants more details.

I don't have good data on how well clocks work when power-saving is enabled.

-------------

If you actually want to know how accurate your hwclock is:
  comment out the line in /etc/init.d/halt,
  reboot,
  check the time,
  wait a week or 10 days,
  check again.
"ntpdate -d <handy-server>" may be the simplest way to check the time.  Grab 
ntpdate from a handy system.
Or run "xclock -analog -update 1" on a system running ntpd and use that to 
calibrate your wrist watch and ...




-- 
These are my opinions, not necessarily my employer's.  I hate spam.






More information about the Devel mailing list