trying to fix time totals

main
KeeganForelight 2 years ago
parent 8b58fe60b2
commit 38ee58a21c

@ -105,11 +105,11 @@ totalHours() {
# session exists, get info
source "$CURRENT_SESSION"
# printing to timesheet
TOTAL_TIME=$(($(date +%s) - $TIME_IN))
time=$(date -d @$(($(date +%s) - $TIME_IN + 3600 * 5)) +%H:%M)
# add to total
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)
hours=$(($hours + 10#$(echo "$time" | awk -F : '{print $1}')))
mins=$(($mins + 10#$(echo "$time" | awk -F : '{print $2}')))
printf 'So far Today worked %s\n' $time
fi
hours=$(($hours + $mins/60)) # overflow
mins=$(($mins%60))

Loading…
Cancel
Save