timestamp-service: use new format also for writing

8228b2d56e
changes the time format written to /etc/timestamp
When the system time is set from the content of /etc/timestamp,
one has to use the new format also.

While at it
- remove the now unneeded cut and concatenation as the string is already
  correctly ordered.
- consistently use absolute pathnames to programs
- don't print warnings when /etc/timestamp does not exist

Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>
(cherry picked from commit 7776d287c3a6666d3789ac0fc706a12b079c1dc7)
Signed-off-by: Max Krummenacher <max.oss.09@gmail.com>
Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>
This commit is contained in:
Max Krummenacher
2014-10-24 19:37:42 +02:00
committed by Koen Kooi
parent cef42c8aba
commit fe0b060343

View File

@@ -5,16 +5,11 @@
# use the timestamp instead.
SYSTEMDATE=$(/bin/date -u "+%4Y%2m%2d%2H%2M")
YEAR=$(cat /etc/timestamp | cut -b 1-4)
MONTH=$(cat /etc/timestamp | cut -b 5-6)
DAY=$(cat /etc/timestamp | cut -b 7-8)
TIME=$(cat /etc/timestamp | cut -b 9-12)
TIMESTAMP=$(/bin/cat /etc/timestamp 2>/dev/null)
TIMESTAMP="$YEAR$MONTH$DAY$TIME"
if [ $SYSTEMDATE -lt $TIMESTAMP ]; then
if [ $SYSTEMDATE -lt $TIMESTAMP ] 2>/dev/null ; then
echo "Update systemtime from /etc/timestamp"
date -u $(cat /etc/timestamp)
/bin/date -u ${TIMESTAMP#????}${TIMESTAMP%????????}
fi
if [ "$1" = "--save" ] ; then