欢迎各位兄弟 发布技术文章
这里的技术是共享的
#!/bin/bash
#
local_time=`/bin/date "+%m%d%H%M%Y.%S"`
net_time=`/usr/bin/curl http://aaaa.com/util/time.php`
echo "AAA"
echo $local_time
echo $net_time
local_time_num=$(echo $local_time*100 | bc )
net_time_num=$(echo $net_time*100 | bc )
echo $local_time_num
echo $net_time_num
local_time_num=$(echo "$local_time_num" | cut -d . -f 1 )
net_time_num=$(echo "$net_time_num" | cut -d . -f 1 )
echo $local_time_num
echo $net_time_num
echo "CCC"
diff=$(echo "$local_time_num - $net_time_num" | bc)
echo "BBB"
echo $diff
if [ $diff -lt 0 ];then
abso_diff=$(($diff * -1 ))
else
abso_diff=$diff
fi
echo $abso_diff