Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
# Start of the script
STARTTIME=$SECONDS
sleep 999
echo "woohoo!!!"
ENDTIME=$SECONDS
DURATION=$(( ENDTIME - STARTTIME ))
# 3600 seconds in an hour
if [ $DURATION -gt 3600 ]; then
DURATION=`echo "scale=2; $DURATION / 3600" | bc`
UNIT="hours";
elif [ $DURATION -gt 60 ]; then
DURATION=`echo "scale=2; $DURATION / 60" | bc`
UNIT="minutes"
else
UNIT="seconds"
fi
CalculateDuration()
{
CD_START="$1"
CD_END="$2"
CD_TOTAL=$(( CD_END - CD_START ))
HOURS=0
MINUTES=0
REMAINING_SECONDS=0
# First, get the number of seconds left after dividing
# by the number of seconds in an hour (60 * 60)
HOURS_REMAINDER=$(( CD_TOTAL % (60*60) ))
# Then, subtract that from the total, and you have the
# number of hours, in seconds
HOURS_SECONDS=$(( CD_TOTAL - HOURS_REMAINDER ))
# Then, divide by the number of seconds in an hour
# (60 * 60) to get just the hours
HOURS=$(( HOURS_SECONDS / (60*60) ))
# Get the number of seconds remaining from calculating
# the hours, and divide that by the number of seconds in
# a minute (60)
MINUTES_REMAINDER=$(( HOURS_REMAINDER % 60 ))
# Then, subtract that from the total number of seconds
# remaining from calculating the hours, and you have the
# number of minutes, in seconds
MINUTES_SECONDS=$(( HOURS_REMAINDER - MINUTES_REMAINDER ))
# Then, divide by the number of seconds in a minute (60)
# to get just the minutes
MINUTES=$(( MINUTES_SECONDS / 60 ))
# Whatever remains is the seconds
REMAINING_SECONDS=$MINUTES_REMAINDER
[ $HOURS -lt 10 ] && HOURS="0$HOURS"
[ $MINUTES -lt 10 ] && MINUTES="0$MINUTES"
[ $REMAINING_SECONDS -lt 10 ] && REMAINING_SECONDS="0$REMAINING_SECONDS"
DURATION="${HOURS}:${MINUTES}:${REMAINING_SECONDS}"
} # End CalculateDuration function