]> code.ossystems Code Review - openembedded-core.git/commitdiff
initscripts: fix timestamp checking at bootmisc.sh
authorLauri Hintsala <lauri.hintsala@bluegiga.com>
Wed, 14 Dec 2011 06:27:27 +0000 (08:27 +0200)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 15 Dec 2011 14:17:19 +0000 (14:17 +0000)
Timestamp checking has been broken by the commit
2078af333d704fd894a2dedbc19cef5775cdadbb. Currently the RTC time
is always overwritten with the time from /etc/timestmap. Fix timestamp
checking and clean the code.

Signed-off-by: Lauri Hintsala <lauri.hintsala@bluegiga.com>
meta/recipes-core/initscripts/initscripts-1.0/bootmisc.sh

index 03fd67c67e631443ac79d49b4f258b291aa8fb8a..ab18ad9b4c1218c375e827706cb33508dcd37b4d 100755 (executable)
@@ -62,15 +62,14 @@ then
 fi
 
 # Set the system clock from hardware clock
-# If the timestamp is 1 day or more recent than the current time,
+# If the timestamp is more recent than the current time,
 # use the timestamp instead.
 /etc/init.d/hwclock.sh start
 if test -e /etc/timestamp
 then
-       SYSTEMDATE=`date  -u +%2m%2d%2H%2M%4Y`
+       SYSTEMDATE=`date -u +%4Y%2m%2d`
        read TIMESTAMP < /etc/timestamp
-        NEEDUPDATE=`expr \( $TIMESTAMP \> $SYSTEMDATE + 10000 \)`
-        if [ $NEEDUPDATE -eq 1 ]; then 
+       if [ ${TIMESTAMP#????????}${TIMESTAMP%????????} -gt $SYSTEMDATE ]; then
                date -u $TIMESTAMP
                /etc/init.d/hwclock.sh stop
        fi