Skip to content

Instantly share code, notes, and snippets.

@yzchen
Created April 21, 2019 09:47
Show Gist options
  • Save yzchen/ae2e4f2d7e7bba5b4f158003b74d2869 to your computer and use it in GitHub Desktop.
Save yzchen/ae2e4f2d7e7bba5b4f158003b74d2869 to your computer and use it in GitHub Desktop.
var1="12:08:18.092077"
var2="12:08:18.405611"
# result : x.xxxx secs
difference=$(( $( date -d "$var2" "+%N" ) - $( date -d "$var1" "+%N" ) )); echo "scale=4; $difference/10^9" | bc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment