From 803534efbe913a2c007a07787761b591c160c4c6 Mon Sep 17 00:00:00 2001 From: ikrong Date: Fri, 5 Jul 2024 14:07:55 +0800 Subject: [PATCH] fix duration --- exec.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/exec.sh b/exec.sh index 56a525a..c4d226a 100755 --- a/exec.sh +++ b/exec.sh @@ -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