back to index | | home .

b8: theming, dog, food, subtract video timestamp, nextdoor noise, Cheng Chieh


#!/bin/bash  
## usage ./script '14:20' '1;2;12.23'  
readTime(){  
#check/convert timestamp format H:M:S.N  
t=$(echo "$1"|tr -s ';' ':')  
colonCount=`echo "$t" |grep -o ":"|wc -l`;  
[[ $colonCount -eq 0 ]] && t="0:0:$t"  
[[ $colonCount -eq 1 ]] && t="0:$t"  
date +%s%2N -d "$t"  
}  

#IFS=' ';read t1 t2 <<< $(echo "$1" "$2")  
a=`readTime "$t1"`  
b=`readTime "$t2"`  
#echo $a $b; exit  
tdiff=`echo "scale=2; ($b-$a)/100"|bc`  
hms=`date -d@$tdiff -u +%H:%M:%S.%2N`  
echo $tdiff "seconds difference OR $hms"