On Tue, Jun 4, 2024 at 3:45 PM Jonas Kvinge
On Tue, 2024-06-04 at 14:04 +0200, Adam Mizerski wrote:
RPi does not have on-board hardware clock with battery. But it can be added: https://pimylifeup.com/raspberry-pi-rtc/
I'm aware. I'm asking if the OS can remember the shutdown time and set that on boot before the time is synced with NTP, this way uptime will show more correctly when you reboot the system. Raspberry Pi Os does this somehow.
"OS" is not an undividable entity. Anything can be done if someone programs it. The systemd-timesyncd by default saves actual timestamp and restores it when initialized if the current time is in the past. You will still have some window before systemd-timesyncd is launched when time will be wrong. https://www.freedesktop.org/software/systemd/man/latest/systemd-timesyncd.se... You can write your own implementation if you like (in principle, it is just "touch /some/file" periodically/on shutdown and "date -r /some/file" on boot. It will have the same window before /some/file is accessible (so time in initrd will be off ... well, /some/file could be on ESP if you are using UEFI).