#!/bin/bash
 
function st() {
  BEGIN=$(date +%s)
  if [ -z "$1" ]; then
    echo Starting Stopwatch...
  else
    echo $@...
  fi

  while true; do
     NOW=$(date +%s)
     let DIFF=$(($NOW - $BEGIN))
     let MINS=$(($DIFF / 60 % 60))
     let SECS=$(($DIFF % 60))
     let HOURS=$(($DIFF / 3600 % 24))
     let DAYS=$(($DIFF / 86400))
     # \r  is a "carriage return" - returns cursor to start of line
     printf "\e[36m\r%3d Days, %02d:%02d:%02d" $DAYS $HOURS $MINS $SECS
     sleep 0.25
  done
}