diff --git a/timetracker.sh b/timetracker.sh index 6717560..1b78419 100755 --- a/timetracker.sh +++ b/timetracker.sh @@ -105,12 +105,11 @@ totalHours() { # session exists, get info source "$CURRENT_SESSION" # printing to timesheet - TIME_OUT=$(date +%s) - TOTAL_TIME=$(($TIME_OUT - $TIME_IN + 3600 * 5)) + TOTAL_TIME=$(($(date +%s) - $TIME_IN)) # add to total - hours=$(($TOTAL_TIME / 3600 + $hours)) - mins=$(($TOTAL_TIME / 60 + $mins)) - printf 'Today worked %s\n' $(date -d @$TOTAL_TIME +%H:%M) + hours=$(($TOTAL_TIME / 3600 + $hours)) # nearest hour + mins=$(($TOTAL_TIME / 60 + $mins)) # nearest minute + printf 'So far Today worked %s\n' $(date -d @$(($TOTAL_TIME + 3600 * 5)) +%H:%M) fi hours=$(($hours + $mins/60)) # overflow mins=$(($mins%60))