Set HW clock

Hi
Trying to set the rtc clock with > sudo hwclock and it doesn’t work.

sudo timedatectl works

Also ls /dev/rtc* shows there are two rtcs : rtc0 and rtc1…

image

Taking a closer looks like one is pmic and one tegra. hwclock command works on tegra_rtc (i.e. if we pass rtc1 as an argument).

The question is there some documentation we can use to figure out which rtc clock should we set time to?

You need to disable ntp before setting date.
sudo timedatectl set-ntp no

Thanks Shane for getting back. Sorry my question is not very clear, i would like to use hwclock command and it only works on rtc1 and doesn’t work on rtc0. so is rtc1 the right one to use?
Are you saying in order to use hwclock on rtc0 i need to turn off ntp? The target is not connected to network so i am not clear why ntp matters.

It could be the ubuntu rule link to rtc0, have modify the rtc0 to rtc1 to try.

root@tegra-ubuntu:/lib/udev# grep -ir rtc0 .
./rules.d/50-udev-default.rules:SUBSYSTEM==“rtc”, KERNEL==“rtc0”, SYMLINK+=“rtc”, OPTIONS+=“link_priority=-100”
./hwclock-set:HCTOSYS_DEVICE=rtc0