initscripts: fix timestamp checking at bootmisc.sh

Timestamp checking has been broken by the commit
2078af333d. Currently the RTC time
is always overwritten with the time from /etc/timestmap. Fix timestamp
checking and clean the code.

(From OE-Core rev: cc8695f22bc70ef958f81d0d3da73dece5f4700a)

Signed-off-by: Lauri Hintsala <lauri.hintsala@bluegiga.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Lauri Hintsala
2011-12-14 08:27:27 +02:00
committed by Richard Purdie
parent fe2d3c0916
commit 91367de755

View File

@@ -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