I'd like to propose the following change, to resolve what appears to be a
difference between how timedatectl is reading the rtc and
sync-clocks.service is reading it.
recipes-core/systemd/systemd/sync-clocks.service:
-ExecStart=/sbin/hwclock --systohc
+ExecStart=/sbin/hwclock --utc --systohc
busybox hwclock by default assumes RTC is in local timezone but can be told
to treat rtc time as UTC by adding --utc.
timedatectl by default assumes the RTC time is in UTC, "RTC in local TZ:
no".
Note testing needs to be done with network disconnected otherwise ntp takes
over.
When system TZ is UTC, local, universal, and rtc time match.
root@mitysom-am57x:~# timedatectl
Local time: Wed 2024-04-10 20:55:35 UTC
Universal time: Wed 2024-04-10 20:55:35 UTC
RTC time: Wed 2024-04-10 20:55:36
Time zone: n/a (UTC, +0000)
System clock synchronized: yes
NTP service: active
RTC in local TZ: no
root@mitysom-am57x:~# hwclock -r
Wed Apr 10 20:55:368 2024 0.000000 seconds
When system TZ is changed to EST, universal and rtc still match, this makes
sense.
root@mitysom-am57x:~# timedatectl set-timezone America/New_York
root@mitysom-am57x:~# timedatectl
Local time: Wed 2024-04-10 17:12:06 EDT
Universal time: Wed 2024-04-10 21:12:06 UTC
RTC time: Wed 2024-04-10 21:12:01
Time zone: America/New_York (EDT, -0400)
System clock synchronized: yes
NTP service: active
RTC in local TZ: no
root@mitysom-am57x:~# hwclock -r
Wed Apr 10 21:12:02 2024 0.000000 seconds
However, after a reboot, RTC time now matches the Local time instead. If
you plug in networking and NTP takes over, RTC time will jump back to UTC.
root@mitysom-am57x:~# timedatectl
Local time: Wed 2024-04-10 17:13:33 EDT
Universal time: Wed 2024-04-10 21:13:33 UTC
RTC time: Wed 2024-04-10 17:13:33
Time zone: America/New_York (EDT, -0400)
System clock synchronized: no
NTP service: active
RTC in local TZ: no
root@mitysom-am57x:~# hwclock -r
Wed Apr 10 17:13:35 2024 0.000000 seconds
With the above-proposed change, this RTC time changing to local time no
longer happens.
--
Jonathan Cormier
Software Engineer
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#15263):
https://lists.yoctoproject.org/g/meta-arago/message/15263
Mute This Topic: https://lists.yoctoproject.org/mt/105451810/21656
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/meta-arago/unsub
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-