base-files: save current time to /etc on poweroff if ntp synced before

even if the RTC fails, we can still keep the time as accurate as possible.
This commit is contained in:
Liangbin Lian 2025-09-23 14:11:57 +08:00
parent 4f24ea6a80
commit 3dc602c80c
2 changed files with 4 additions and 0 deletions

View File

@ -0,0 +1,3 @@
[ "$ACTION" = "stratum" ] || exit 0
touch /var/state/ntp_last_sync

View File

@ -22,6 +22,7 @@ start() {
}
stop() {
[ -e /var/state/ntp_last_sync ] && touch /etc/.last_saved_time
hwclock_save
}