nix/bin/sw

18 lines
341 B
Text
Raw Normal View History

2023-09-05 13:52:52 -05:00
#!/usr/bin/env bash
d="$(date +%s)"
_dt=$(($(date +%s) - d))
echo "Stopwatch started $(date)"
trap 'echo -ne "\nStopwatch stopped at $(date)\n" && exit 0' SIGINT
while true; do
_dt=$(($(date +%s) - d))
days=$((_dt / 86400))
echo -ne "\r${days}d $(date -u --date @$((_dt)) +%H:%M:%S) "
sleep 0.1
done
# TODO: add "lap" capabilities?