Skip to content

Commit

Permalink
Use chrono for stop watch
Browse files Browse the repository at this point in the history
  • Loading branch information
rdavid committed Jan 2, 2024
1 parent 4250ae9 commit ba43475
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions app/myip
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,14 @@
# shellcheck disable=SC1091,SC2034 # File not following, appears unused.
set -- "$@" --quiet
readonly \
BASE_APP_VERSION=0.9.20231216 \
BASE_MIN_VERSION=0.9.20230505
BASE_APP_VERSION=0.9.20240102 \
BASE_MIN_VERSION=0.9.20240102
. base.sh

# The index starts with 0, it guarantees the title printing from the begging.
main() {
validate_cmd awk dig whois
chrono_sta run || die
local i=0
while :; do
[ $((i % 24)) -eq 0 ] && title
Expand Down Expand Up @@ -78,7 +79,7 @@ myip() {
var_exists state >/dev/null 2>&1 ||
state=NO
}
dur="$(base_duration "$BASE_BEG")" || die
dur="$(chrono_get run)" || die
ip="$(printf %15s "$ip")"
tsout "| $ip | $state | $dur"
}
Expand Down

0 comments on commit ba43475

Please sign in to comment.