Files

17 lines
450 B
Bash
Raw Permalink Normal View History

2025-03-18 19:19:34 +01:00
#!/bin/bash
2025-05-08 01:32:57 +02:00
start_stopwatch() {
local start_time=$SECONDS
export SCRIPT_START_TIME=$start_time
2025-03-18 19:19:34 +01:00
}
2025-05-08 01:32:57 +02:00
stop_stopwatch() {
local end_time=$SECONDS
local start_time=$SCRIPT_START_TIME
local duration=$((end_time - start_time))
local minutes=$((duration / 60))
local seconds=$((duration % 60))
local milliseconds=$((duration * 1000 % 1000))
echo "Script execution time: ${minutes} m : ${seconds} s : ${milliseconds} ms"
2025-03-18 19:19:34 +01:00
}