Commit f730b322 authored by Mike Hibler's avatar Mike Hibler

Fixed check vs. max offset, it was wrong.

If number was positive, was converting to "(N)" for some reason.
Parens don't compare well with integers...

Also don't need "bc" just to compute abs(), just use "tr" to remove '-'.

Also adjust the max offset a smidge to 5ms, 1ms is a bit tight.
parent f1120a88
......@@ -25,7 +25,7 @@
echo -n ' Starting timecheck.. '
ntpserver="ntp1"
maxdrift="0.001"
maxdrift="0.005"
source checkutils.sh
......@@ -39,7 +39,7 @@ x=$(caller)
s=""
case $os in
Linux | FreeBSD )
progs="tr bc ntpdate host"
progs="tr ntpdate host"
;;
* )
failed="Unknown OS :$os: FAILED"
......@@ -96,7 +96,7 @@ case $os in
((++idx))
z=${d[$idx]}
offset=$(echo ${z} | tr -d ,) # remove comma
[[ $offset < 0 ]] && a=$(echo "-($offset)" | bc) || a=$(echo "($offset)") # make $a abs()
[[ $offset < 0 ]] && a=$(echo $offset | tr -d '-') || a=$offset # make $a abs()
[[ $a > $maxdrift ]] && failed="maxdrift"
if [ -z "${failed}" ]; then
echo "Time check passed offset $offset allowed $maxdrift"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment