2014-09-30 03:29:58 +02:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
# it is in format of `date -u -Iseconds`, example: 2014-09-29T22:59:21+0000
|
|
|
|
# it comes from dom0, so is trusted
|
2017-09-30 04:45:31 +02:00
|
|
|
read -r timestamp
|
|
|
|
timediff=$(( $(date -u +'+%Y%m%d%H%M%S') - $(date -u -d "$timestamp" +'+%Y%m%d%H%M%S') ))
|
|
|
|
if [ "$timediff" -le 2 ] && [ "$timediff" -ge -2 ]; then
|
2014-09-30 03:29:58 +02:00
|
|
|
# don't bother
|
|
|
|
exit 0
|
|
|
|
fi
|
2016-01-07 05:06:39 +01:00
|
|
|
date -u -s "$timestamp" >/dev/null
|