diff options
Diffstat (limited to 'etc/functions/countdown')
-rw-r--r-- | etc/functions/countdown | 31 |
1 files changed, 0 insertions, 31 deletions
diff --git a/etc/functions/countdown b/etc/functions/countdown deleted file mode 100644 index 28639f4..0000000 --- a/etc/functions/countdown +++ /dev/null @@ -1,31 +0,0 @@ -## vim:ft=zsh -## Countdown to a specific date/time -## Usage: countdown <string understood by 'date -d'> -## or: countdown +<seconds> -## Copyright (C) 2008-2009 by Daniel Friesel <derf@derf.homelinux.org> -## License: WTFPL <http://sam.zoy.org/wtfpl> - -autoload check_com -typeset -i beep=0 -typeset -i seconds -typeset date - -if check_com beep; then - beep=1 -fi - -if [[ $1 == +* ]] { - date=@$(($(date +%s) + ${1#+})) -} else { - date="$*" -} - -while true; do - seconds=$[$(date -d $date +%s)-$(date +%s)] - printf '%02d:%02d:%02d' $((seconds/3600)) $(((seconds/60)%60)) $((seconds%60)) - if (( seconds <= 0 )) { - (( beep )) && beep || echo -ne "\a" - } - sleep 1 - echo -ne "\r\e[2K" -done |