fake-hwclock: Add hwclock --systohc to synchronize hardware clock #2058
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR adds the command
hwclock --systohc
to thefake-hwclock
script located in/usr/lib/systemd/scripts/fake-hwclock.sh
. The purpose of this addition is to ensure that after restoring the system time from the saved state, the hardware clock (RTC) is synchronized with the system time. This is crucial for maintaining accurate timekeeping on systems without a reliable RTC, especially in cases where the system may be rebooted or powered off frequently.Rationale
The
fake-hwclock
package is intended to simulate an RTC on systems that lack one. However, after restoring the system time, there is currently no step that updates the actual hardware clock with the restored time. By addinghwclock --systohc
, we ensure that the RTC is kept in sync with the restored time, improving the reliability of timekeeping across reboots.Changes Introduced
fake-hwclock.sh
script now includes the commandhwclock --systohc
immediately after the time is restored usingdate -s @$savedtime
.Compliance
pkgver
remains unchanged as this is a minor enhancement.pkgrel
has been incremented to1.1
to reflect the change and ensure proper tracking against upstream.