hwclock accuracy
Jerry Vonau
jvonau at shaw.ca
Thu Jan 20 09:26:55 EST 2011
On Thu, 2011-01-20 at 02:15 -0800, Hal Murray 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?
>
> 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.
>
The main problem is /etc/adjtime doesn't keep it's data used to track
whether the rtc is in localtime or utc time, the readonly filesystem
layout resets this file on reboot.
https://dev.laptop.org.au/issues/299
http://dev.laptop.org/ticket/10605
> 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.
>
With my observations I'd used the rtc as the source, as the system is
drifting over a 1 min per hour.
> 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 would be great to use but a ntp client is not installed by default.
> 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.
>
You might be on to something there, on one XO-1.5 with uptime of 12
hours (inactive, I was sleeping), the system clock is now out over 3
hours in that time frame while the rtc is accurate. Well it's not out 3
hours... ;)
> -------------
>
> 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 ...
Going down that route chasing this,
Jerry
More information about the Devel
mailing list