timestamp-service: don't restore time on shutdown
load-timestamp.sh --save should only save the current systemtime and not evaluate /etc/timestamp and change the systemtime. If the systemtime has been changed to something in the past of /etc/timestamp then that change should be accepted without further checks. While at it correct the comment. The RTC/hwclock is not touched by the timestamp service. This is a copy paste error from the init.d implementation in openembedded-core/meta/recipes-core/initscripts/initscripts-1.0/bootmisc.sh Signed-off-by: Max Krummenacher <max.oss.09@gmail.com> Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>
This commit is contained in:
committed by
Koen Kooi
parent
fe0b060343
commit
ffb89f034e
13
recipes-core/systemd/timestamp-service/load-timestamp.sh
Executable file → Normal file
13
recipes-core/systemd/timestamp-service/load-timestamp.sh
Executable file → Normal file
@@ -1,8 +1,11 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Set the system clock from hardware clock
|
||||
# If the timestamp is 1 day or more recent than the current time,
|
||||
# use the timestamp instead.
|
||||
if [ "$1" != "--save" ] ; then
|
||||
|
||||
# Set the system clock from timestamp file
|
||||
# if the timestamp is 1 minute or more recent
|
||||
# than the current systemtime.
|
||||
|
||||
SYSTEMDATE=$(/bin/date -u "+%4Y%2m%2d%2H%2M")
|
||||
|
||||
TIMESTAMP=$(/bin/cat /etc/timestamp 2>/dev/null)
|
||||
@@ -12,7 +15,7 @@ if [ $SYSTEMDATE -lt $TIMESTAMP ] 2>/dev/null ; then
|
||||
/bin/date -u ${TIMESTAMP#????}${TIMESTAMP%????????}
|
||||
fi
|
||||
|
||||
if [ "$1" = "--save" ] ; then
|
||||
else
|
||||
# Store the current systemtime in /etc/timestamp
|
||||
/bin/date -u +%4Y%2m%2d%2H%2M > /etc/timestamp
|
||||
fi
|
||||
|
||||
|
||||
Reference in New Issue
Block a user