diff options
Diffstat (limited to 'scripts/testing/lib/logging.sh')
| -rwxr-xr-x | scripts/testing/lib/logging.sh | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/scripts/testing/lib/logging.sh b/scripts/testing/lib/logging.sh index eda9eb1..ed20707 100755 --- a/scripts/testing/lib/logging.sh +++ b/scripts/testing/lib/logging.sh @@ -135,8 +135,13 @@ start_timer() { stop_timer() { local name="${1:-default}" - local start=${TIMERS[$name]} - local end=$(date +%s) + local start="${TIMERS[$name]:-}" + if [ -z "$start" ]; then + log "TIMER STOP: $name (never started, skipping)" + return 0 + fi + local end + end=$(date +%s) local duration=$((end - start)) local mins=$((duration / 60)) local secs=$((duration % 60)) |
