A command line stopwatch
00:00:07.235
make
# Install
mv ./bin/sw /usr/bin
# Display help
sw --help
Foreground and background color
# Start a stopwatch
sw
# Start a countdown (hh:mm:ss)
sw -c 00:00:30
# Change the display format (mm:ss.zzz) / (mm:ss)
sw -f %M:%S
sw -f %M:%S -m
# Execute cmd after the countdown
sw -c 00:00:30 && cmd
# Measure the execution time of a process
ping localhost -c 3 | sw
# On unix system, you can change the display color
./sw --fg 97 --bg 45
Stopwatch sw;
sw.start();
// do something
// https://en.cppreference.com/w/cpp/io/manip/put_time
cout << sw.elapsed("%H:%M:%S", true) << endl;