What's the easiest way to make Busybox keep correct time?

Cathey, Jim jcathey at ciena.com
Tue Sep 2 19:12:45 UTC 2014


>I would HOPE that flash memory has improved in the past 20 years,

The underlying physics really hasn't.  Some devices are more
robust, but the less expensive ones aren't.  They're a lot bigger,
is all.  You need to KNOW where and what is kept, if you want to
have any confidence in the long-term reliability of your system.

>would you care to share the procedure you have used to
>get the time that accurate?  And do you have to run something at every
>reboot to do the time correction, or is this a "set it once and forget it"
>type of thing?

This is/was part of a proprietary system, but I do know that it
kept track of _when_ a time correction was applied, and how much
was applied, from which it extrapolated the amount of drift the
clock would have at any point.  In practice it worked out very well,
provided you did not try to 'correct' the time too much!  The
main secret is that the HW clock's own time was NEVER changed!
That gave you the long-term baseline from which you could calculate
the inherent drift in the system.  The longer you waited before giving
it a correction, the better the correction was.  Because the HW
time was never changed, a later correction's timebase was not
just from the prior correction, but from time zero.

This corrected HW value was applied to the kernel at startup, which
would also add/withhold a microtick every so often (based on the
calculated drift) in order to apply the correction.

You would only have to change the HW clock's stored base time if there
was a battery change, or something like an ESD event wiped out the
clock itself or the clock crystal was changed out.  But then you'd
have to start the recalibration cycle all over again.

Our NTP was tweaked to work with this system.  In fact, it was the
early NTP implementation that was responsible for destroying the
clock EEPROM hardware.  Faces were red.

-- Jim



More information about the busybox mailing list