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...@gmail.com>
---
 recipes-core/systemd/timestamp-service/load-timestamp.sh | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)
 mode change 100755 => 100644 
recipes-core/systemd/timestamp-service/load-timestamp.sh

diff --git a/recipes-core/systemd/timestamp-service/load-timestamp.sh 
b/recipes-core/systemd/timestamp-service/load-timestamp.sh
old mode 100755
new mode 100644
index d65c729..9ad0e94
--- a/recipes-core/systemd/timestamp-service/load-timestamp.sh
+++ b/recipes-core/systemd/timestamp-service/load-timestamp.sh
@@ -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
-
-- 
1.9.3


_______________________________________________
Angstrom-distro-devel mailing list
Angstrom-distro-devel@linuxtogo.org
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/angstrom-distro-devel

Reply via email to