More declarative way of saying "every x minutes, give or take"
Wed Jun 15 09:22:12 UTC 2011 pix@kepibu.org
* More declarative way of saying "every x minutes, give or take"
diff -rN -u old-claki/claki.lisp new-claki/claki.lisp
--- old-claki/claki.lisp 2013-07-22 03:24:18.000000000 +0000
+++ new-claki/claki.lisp 2013-07-22 03:24:18.000000000 +0000
@@ -188,12 +188,13 @@
(defun seconds (s) s)
(defun minutes (m) (* (seconds 60) m))
(defun hours (h) (* (minutes 60) h))
+(defun plus-or-minus (x y) (+ (- x y) (random (* 2 y))))
(defconstant +simple-time+ '(:year #\- :month #\- :day #\Space :hour #\: :min #\: :sec))
(defun run-for-a-while ()
(dotimes (i 20)
- (sleep (minutes (+ 25 (random 10))))
+ (sleep (minutes (plus-or-minus 30 5)))
(format t "; Unattented run at ~a~%" (local-time:format-timestring nil (local-time:now) :format +simple-time+))
(unattended-revert-new-spam)
(save-state)))