(defpackage time-iterator (:nicknames ti-it))
(in-package ti-it)

;;;*****************************************************************
;;;Customize timezone here******************************************
(defparameter *timezone* -9)
(defparameter *day-sec* (* 24 60 60))

(defvar *from-date-sec*)
(defvar *to-date-sec*)
(defvar *increment*)

;;;*****************************************************************
;;;Customize from date on the next line*****************************
(let ((second 0) (minute 0) (hour 13) (date 1) (month 1) (year 1970) (timezone *timezone*))
 (setq *from-date-sec*
  (encode-universal-time second minute hour date month year timezone)))

;;;*****************************************************************
;;;Customize to date on the next line*******************************
(let ((second 0) (minute 0) (hour 13) (date 1) (month 5) (year 1970) (timezone *timezone*))
 (setq *to-date-sec*
  (encode-universal-time second minute hour date month year timezone)))
 
;;;*****************************************************************
;;;Customize number-days to increment*******************************
(let ((number-days 30)) (setq *increment* (* number-days *day-sec*)))

(loop
 for date-in-sec from *from-date-sec* to *to-date-sec* by *increment*
 for date-3days = (- date-in-sec (* 3 *day-sec*))
 for date+3days = (+ date-in-sec (* 3 *day-sec*)) ;;Could change the number(s) 3 here.

 do (loop for utime in (list date-3days date-in-sec date+3days)
     do (multiple-value-bind (second minute hour date month year day summer timezone)
         (decode-universal-time utime *timezone*)

         (loop for value in (list date month year)
           for desc in (list "date" "month" "year")
           do (princ desc)
           do (princ ":")
           do (princ value)
           do (princ " ")
           finally (terpri)))
      finally (terpri))
 finally (si:quit))