Function: icalendar-recur-refine-byhour
icalendar-recur-refine-byhour is a byte-compiled function defined in
icalendar-recur.el.gz.
Signature
(icalendar-recur-refine-byhour INTERVAL HOURS &optional VTIMEZONE)
Documentation
Resolve INTERVAL into a list of subintervals matching HOURS.
HOURS should be a list of values from a recurrence rule's
BYHOUR=... clause; see icalendar-recur for the possible values.
Source Code
;; Defined in /usr/src/emacs/lisp/calendar/icalendar-recur.el.gz
(defun icr:refine-byhour (interval hours &optional vtimezone)
"Resolve INTERVAL into a list of subintervals matching HOURS.
HOURS should be a list of values from a recurrence rule's
BYHOUR=... clause; see `icalendar-recur' for the possible values."
(let* ((sorted-hours (sort hours))
(interval-start (icr:interval-low interval))
(interval-end (icr:interval-high interval))
(curr-dt interval-start)
(subintervals nil))
(while curr-dt
;; For each day in the interval...
(dolist (h sorted-hours)
;; ...the subinterval is one hour long in the given hour
(let* ((low (ical:date-time-variant curr-dt
:hour h :minute 0 :second 0
:tz vtimezone))
(high (ical:date/time-add low :hour 1 vtimezone)))
(ignore-errors ; do not generate subintervals for nonexistent times
(when (ical:date/time< low curr-dt)
(setq low curr-dt))
(when (ical:date/time< interval-end high)
(setq high interval-end))
(when (and (ical:date/time<= interval-start low)
(ical:date/time< low high)
(ical:date/time<= high interval-end))
(push (icr:make-interval low high) subintervals)))))
(setq curr-dt (ical:date/time-add curr-dt :day 1 vtimezone))
(when (ical:date-time<= interval-end curr-dt)
;; we're done:
(setq curr-dt nil)))
(nreverse subintervals)))