Re: Automatical handling of /sys/class/rtc/rtcN/offset

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Dear Alexandre,

Hi,

On 26/05/2020 21:57:50+0300, Igor Plyatov wrote:
I have found that my RTC  (M41T00) is capable to make precise compensation
of offset in the Control register.

Its driver, rtc-ds1307.c has support for such offset compensation and
provide the /sys/class/rtc/rtc0/offset file.

Compensation tested and operate as expected, when I manually read/write
offset value (in PPB) from/into the /sys/class/rtc/rtc0/offset file.

Does handling of such RTC offset already automatized somehow instead of
doing this manually?

No, my plan was to add support for that in chrony. chrony is already
able to calculate the correct offset but it doesn't make use of it for
the moment.

What are you using to calculate the offset?

Currently I do not have production ready solution for RTC offset compensation.

For test purpose I do following:

* synchronize OS time to NTP - ntpd -q -n;

* copy OS time to RTC - hwclock --systohc;

* wait some period of time (24 hours or more) to reach noticeable RTC offset;

* copy RTC time to OS - hwclock --hctosys;

* synchronize OS time to NTP - ntpd -q -n.

Last step show me RTC offset, which used below in calculation of RTC drift, in ppb.

RTC_drift = 1000000000 * RTC_offset / Time_period.

For example, RTC_drift = 1000000000 * (-5.0676 s) / (24*60*60) = -58653 ppb.

Apply negative RTC_drift to Control register of RTC by command

echo "58653" > /sys/class/rtc/rtc0/offset.

Best wishes.

--

Igor Plyatov




[Index of Archives]     [Linux Sound]     [ALSA Users]     [ALSA Devel]     [Linux Audio Users]     [Linux Media]     [Kernel]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux