!/bin/bash
function timediff() { start_time=$1 end_time=$2
start_s=${start_time%.*} start_nanos=${start_time#*.} end_s=${end_time%.*} end_nanos=${end_time#*.}
if [ "$end_nanos" -lt "$start_nanos" ];then end_s=$(( 10#$end_s - 1 )) end_nanos=$(( 10#$end_nanos + 10**9 )) fi
time=$(( 10#$end_s - 10#$start_s )).`printf "%03d\n" $(( (10#$end_nanos - 10#$start_nanos)/10**6 ))` echo $time }
trap "clear;exit" 2
clear
echo -e "\033[?25l"
diff=0 str=`date +'%Y / %m / %d %H : %M : %S'` while true do figlet -w 120 -f big -c "${str}"
start=$(date +'%s.%N') str=`date +'%Y . %m . %d - %H : %M : %S'` echo -ne "$report" echo -ne "\033[1;1H" a=`timediff $start $end` b=1 end=$(date +'%s.%N')
sleep `awk 'BEGIN{print "'$end'" - "'$start'"}'` done
|