Skip to content

Instantly share code, notes, and snippets.

@nicdoye
Created August 9, 2017 15:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nicdoye/4d78b35aa1518c977e727bb362cb4446 to your computer and use it in GitHub Desktop.
Save nicdoye/4d78b35aa1518c977e727bb362cb4446 to your computer and use it in GitHub Desktop.
Minutes and Seconds from milliseconds
# Contains a rounding error, but we didn't need the accuracy
# Check if $response is an empty string or not a number
if [ -z ${response} ] || [ $(( ${response} + 0 )) == 0 ]
then
mins=undef
secs=undef
then
else
mins=$(( ${response} / 1000 / 60 ))
secs=$(( ${response} / 1000 - 60 * ${mins} ))
fi
echo "$mins minutes and $secs seconds"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment