feat: add stopwatch
This commit is contained in:
parent
31bbdf5547
commit
0cb6a44391
20
bin/stopwatch
Executable file
20
bin/stopwatch
Executable file
|
@ -0,0 +1,20 @@
|
|||
#!/bin/sh
|
||||
|
||||
stopwatch() {
|
||||
local BEGIN=$(date +%s)
|
||||
echo Starting Stopwatch...
|
||||
|
||||
while true; do
|
||||
local NOW=$(date +%s)
|
||||
local DIFF=$(($NOW - $BEGIN))
|
||||
local MINS=$(($DIFF / 60))
|
||||
local SECS=$(($DIFF % 60))
|
||||
local HOURS=$(($DIFF / 3600))
|
||||
local DAYS=$(($DIFF / 86400))
|
||||
|
||||
printf "\r%3d Days, %02d:%02d:%02d" $DAYS $HOURS $MINS $SECS
|
||||
sleep 0.5
|
||||
done
|
||||
}
|
||||
|
||||
stopwatch
|
Loading…
Reference in New Issue
Block a user