Skip to content

Commit

Permalink
numeric sort to handle pre-9/11 epoch times properly. thx @Bender1061
Browse files Browse the repository at this point in the history
  • Loading branch information
scottleibrand committed Oct 4, 2016
1 parent 2f0cc21 commit bcb0ca7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions bin/oref0-set-system-clock.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,6 @@ checkNTP() { ntp-wait -n 1 -v || ( sudo /etc/init.d/ntp restart && ntp-wait -n 1
if ! checkNTP; then
# set system time to pump time if pump time is newer than the system time (by printing out the current epoch, and the epoch generated from the $CLOCK file, and using the most recent)
echo Setting system time to later of `date` or `cat $CLOCK`:
echo "(date +%s; date -d `( cat $CLOCK; echo ) | sed 's/\"//g'` +%s) | sort | tail -1 | while read line; do sudo date -s @\$line; done;"
(date +%s; date -d `( cat $CLOCK; echo ) | sed 's/"//g'` +%s) | sort | tail -1 | while read line; do sudo date -s @$line; done;
echo "(date +%s; date -d `( cat $CLOCK; echo ) | sed 's/\"//g'` +%s) | sort -g | tail -1 | while read line; do sudo date -s @\$line; done;"
(date +%s; date -d `( cat $CLOCK; echo ) | sed 's/"//g'` +%s) | sort -g | tail -1 | while read line; do sudo date -s @$line; done;
fi

0 comments on commit bcb0ca7

Please sign in to comment.