diff options
author | elioat <elioat@tilde.institute> | 2023-02-27 13:09:17 -0500 |
---|---|---|
committer | elioat <elioat@tilde.institute> | 2023-02-27 13:09:17 -0500 |
commit | 42ee50b88f10b7578c9ea4271c13aaa77ed66e73 (patch) | |
tree | 2b7473eed6f06b4b2c7a38e25a2d224bb837ec5b /rnd | |
parent | a36b86811b276916adbda6120c1cac8058ac4c17 (diff) | |
download | december-2022-42ee50b88f10b7578c9ea4271c13aaa77ed66e73.tar.gz |
Diffstat (limited to 'rnd')
-rw-r--r-- | rnd/clj/timer.clj | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/rnd/clj/timer.clj b/rnd/clj/timer.clj new file mode 100644 index 0000000..47fef78 --- /dev/null +++ b/rnd/clj/timer.clj @@ -0,0 +1,13 @@ +;; timer.clj + +(defn print-without-newline [string] + (print string) + (flush)) + +(defn timer-for [minutes] + (let [seconds (* minutes 60)] + (doseq [n (reverse (range seconds))] + (Thread/sleep 1000) + (print-without-newline (str "\r" (quot n 60) " m " (mod n 60) " s "))))) + +(timer-for 1.1) \ No newline at end of file |