Add helpful scripts for timing stuff

This commit is contained in:
Daniel Flanagan 2019-09-25 07:16:15 -05:00
parent a2280f38e7
commit 63a4c3122b
2 changed files with 24 additions and 0 deletions

13
scripts/bin/countdown Executable file
View file

@ -0,0 +1,13 @@
#!/usr/bin/env bash
d=$((`date +%s` + $1));
echo "Countdown started $(date)"
while [ "$d" -ge $(date +%s) ]; do
_dt=$(($d - `date +%s`))
days=$((_dt / 86400))
echo -ne "\r${days}d $(date -u --date @$((_dt)) +%H:%M:%S) ";
sleep 0.1
done
echo -ne "\rCountdown finished $(date)\n"

11
scripts/bin/sw Executable file
View file

@ -0,0 +1,11 @@
#!/usr/bin/env bash
d="$(date +%s)"
echo "Stopwatch started $(date)"
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