You are not logged in.

#1 2020-04-02 14:22:30

blochl
Member
Registered: 2018-08-31
Posts: 77

System clock not synced to RTC on boot

Hi,

On boot, my system time is way-way (few months!) out of sync from my RTC (the RTC time is correct). That's not a problem when there is a network connection - NTP fixes that, but when there is no network, I'd like my system time to be the same as the RTC on boot (ignoring the timezone for now).

I know I can run `hwclock --hctosys` on boot, and it works, but shouldn't the kernel do this automatically?

I have the following in my kernel config:

CONFIG_RTC_HCTOSYS=y
CONFIG_RTC_HCTOSYS_DEVICE="rtc0"

(And it's indeed `rtc0`)

Offline

#2 2020-04-02 14:41:31

seth
Member
Registered: 2012-09-03
Posts: 51,261

Re: System clock not synced to RTC on boot

Maybe the device shows up too late?

dmesg | grep -i rtc
lsmod | grep -i rtc

Online

#3 2020-04-02 15:11:40

blochl
Member
Registered: 2018-08-31
Posts: 77

Re: System clock not synced to RTC on boot

seth wrote:
dmesg | grep -i rtc
lsmod | grep -i rtc

Hmm... strange - both are empty!

However:

find /sys/ -name rtc0
-----------------------------
/sys/class/rtc/rtc0
/sys/devices/platform/rtc_cmos/rtc/rtc0

For comparison, on another machine where it does work, `dmesg | grep -i rtc` gives:

[    0.518815] PM: RTC time: 07:51:30, date: 2020-04-02
[    2.592682] rtc_cmos 00:02: RTC can wake from S4
[    2.592967] rtc_cmos 00:02: registered as rtc0
[    2.592988] rtc_cmos 00:02: alarms up to one month, y3k, 242 bytes nvram, hpet irqs
[    2.621789] rtc_cmos 00:02: setting system clock to 2020-04-02T07:51:33 UTC (1585813893)

...and `lsmod | grep -i rtc` is empty as well.

Last edited by blochl (2020-04-02 15:42:26)

Offline

Board footer

Powered by FluxBB