Question: how to calculate time difference in bash?
Answer: Bash variable SECONDS (if SECONDS is unset it loses its special property). ...  Bash printf option %(datefmt)T : a="$(TZ=UTC0 printf '%(%s)T\n' '-1')" ### `-1` is the current time sleep 1 ### Process to execute elapsedseconds=$(( $(TZ=UTC0 printf '%(%s)T\n' '-1') - a ))