hwclock accuracy

Sridhar Dhanapalan sridhar at laptop.org.au
Thu Jan 20 08:02:29 EST 2011

On 20 January 2011 21:15, Hal Murray <hmurray at megapathdsl.net> wrote:
>> 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?

Never did.

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

I think that's consistent with our problem. The system clock seems to
be very inaccurate, and if it's writing to the hardware clock, it will
be making it skew considerably.

We've actually disabled the /sbin/hwclock --systohc in our latest
build (probably to be released tomorrow).

Related issues in our system are:


> 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