initscripts: save /etc/timestamp with seconds accuracy

Currently, /etc/timestamp is saved with minutes accuracy.  To increase
the accuracy, modify the save-rtc.sh and bootmisc.sh scripts to save and
read /etc/timestamp respectively with seconds accuracy.

(From OE-Core rev: 8fed53e4e72230c61f23cb36eda36c228aede1e0)

Signed-off-by: Richard Tollerton <rich.tollerton@ni.com>
Signed-off-by: Ben Shelton <ben.shelton@ni.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Blair Elliott 2014-07-17 16:56:53 -05:00 committed by Richard Purdie
parent b573ae8011
commit 00017b4dd8
3 changed files with 5 additions and 4 deletions

View File

@ -359,7 +359,7 @@ set_image_autologin () {
# Can be use to create /etc/timestamp during image construction to give a reasonably
# sane default time setting
rootfs_update_timestamp () {
date -u +%4Y%2m%2d%2H%2M >${IMAGE_ROOTFS}/etc/timestamp
date -u +%4Y%2m%2d%2H%2M%2S >${IMAGE_ROOTFS}/etc/timestamp
}
# Prevent X from being started

View File

@ -66,10 +66,11 @@ fi
test -x /etc/init.d/hwclock.sh && /etc/init.d/hwclock.sh start
if test -e /etc/timestamp
then
SYSTEMDATE=`date -u +%4Y%2m%2d%2H%2M`
SYSTEMDATE=`date -u +%4Y%2m%2d%2H%2M%2S`
read TIMESTAMP < /etc/timestamp
if [ ${TIMESTAMP} -gt $SYSTEMDATE ]; then
date -u ${TIMESTAMP#????}${TIMESTAMP%????????}
# format the timestamp as date expects it (2m2d2H2M4Y.2S)
date -u ${TIMESTAMP:4:8}${TIMESTAMP:0:4}.${TIMESTAMP:(-2)}
test -x /etc/init.d/hwclock.sh && /etc/init.d/hwclock.sh stop
fi
fi

View File

@ -10,4 +10,4 @@
### END INIT INFO
# Update the timestamp
date -u +%4Y%2m%2d%2H%2M > /etc/timestamp
date -u +%4Y%2m%2d%2H%2M%2S > /etc/timestamp