blob: 6902d1d3228b7143ea704c03d1e876f202d1e03b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
#!/bin/sh
if [ "$1" != "--save" ] ; then
# Set the system clock from timestamp file
# if the timestamp is 1 second or more recent
# than the current systemtime.
SYSTEMDATE=$(/bin/date -u "+%4Y%2m%2d%2H%2M%2S")
TIMESTAMP=$(/bin/cat /etc/timestamp 2>/dev/null)
if [ $SYSTEMDATE -lt $TIMESTAMP ] 2>/dev/null ; then
echo "Update systemtime from /etc/timestamp"
/bin/date -u ${TIMESTAMP:4:8}${TIMESTAMP:0:4}.${TIMESTAMP:(-2)}
fi
else
# Store the current systemtime in /etc/timestamp
/bin/date -u +%4Y%2m%2d%2H%2M%2S > /etc/timestamp
fi
|