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:
parent
4f24ea6a80
commit
3dc602c80c
3
package/base-files/files/etc/hotplug.d/ntp/00-savelatest
Normal file
3
package/base-files/files/etc/hotplug.d/ntp/00-savelatest
Normal file
@ -0,0 +1,3 @@
|
||||
[ "$ACTION" = "stratum" ] || exit 0
|
||||
|
||||
touch /var/state/ntp_last_sync
|
||||
@ -22,6 +22,7 @@ start() {
|
||||
}
|
||||
|
||||
stop() {
|
||||
[ -e /var/state/ntp_last_sync ] && touch /etc/.last_saved_time
|
||||
hwclock_save
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user