[ntp:questions] NTP on embedded Linux with GPRS connection

unruh unruh at invalid.ca
Thu Nov 24 22:12:53 UTC 2011

On 2011-11-24, mass85 at tlen.pl <mass85 at tlen.pl> wrote:
>> There is an inherent difficulty in hwclock. When you determine its drift
>> rate, the computer is on and warm. When it is acually useful, to tell
>> the difference between the rtc time and true time, the drift rate is
>> different because the computer is off (cold). This has a few PPM (up to
>> 10) effect on the drift rate.
> My device is not a computer, its temperature is lower. But on the
> other hand it is sensitive to the outside air temperature that can
> vary during a day or a week pretty much. In this case I'm not sure if
> any calibration makes sense.
>> hwclock, at least one version of it . There are ( were?) two development
>> streams with the same name, but different behaviour. One ?does try to do an rtc recalibration
>> as well. Again it has nothing to do with ntp. It sets the clock before
>> ntpd gets it.
> Are you talking about Busybox and regular implementations of hwclock?
> The former one does not apply any corrections to RTC. The latter
> calculates RTC's drift when we write to RTC. Can ntp call
> automatically some script whenever it gets close to reference clock?

No idea what this means. ntp has nothing to do with rtc. ntp assumes
that you have already set the system time from something ( wristwatch,
rtc, sanddial,...) when it starts. Thus the usual procedure is for the
power on routines to first use something like hwclock to set the system
time from the rtc, applying the drift correction if applicable. Then
ntpd is started and it queries its servers (other machines or refclocks)
to correct the system clock.

ntpd also sets the 11 min mode which resets the rtc every 11 min to the
current system time. This means that any attempt by hwclock to determine
the drift or the rtc is doomed.

chrony will set the system clock from the rtc, and will continuously
determine the drift of the rtc, and periodically write it out to a file
(rtc.drift). It can then use that the next time it uses the rtc to set
the system time. HOwever as I mentioned, both hwclock and rtc determine
the drift whent he system is on, and the drift when it is off could be
different (usually temperature).

> Marcin

More information about the questions mailing list