Skip to content

Commit

Permalink
fix duration
Browse files Browse the repository at this point in the history
  • Loading branch information
ikrong committed Jul 5, 2024
1 parent 0ef6920 commit 803534e
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions exec.sh
Original file line number Diff line number Diff line change
Expand Up @@ -414,8 +414,14 @@ function status() {
clear
duration=$( [ "$(uname)" = "Linux" ] && echo "$(date -d "$time" "+%s")" || echo "$(date -u -jf "%Y-%m-%dT%H:%M:%SZ" "$time" "+%s")" )
duration=$(( $(date "+%s") - $duration ))
if [ $duration -ge 3600 ]; then
duration="$((duration/60))min"
if [ $duration -ge 120 ]; then
local m=$((duration/60))
local s=$((duration%60))
if [ $s -eq 0]; then
duration="${m}min"
else
duration="${m}min${s}s"
fi
else
duration="${duration}s"
fi
Expand Down

0 comments on commit 803534e

Please sign in to comment.