Function: icalendar-recur-tz-set-zones-in

icalendar-recur-tz-set-zones-in is a byte-compiled function defined in icalendar-recur.el.gz.

Signature

(icalendar-recur-tz-set-zones-in VTIMEZONES NODE)

Documentation

Recursively set time zone offset and dst flags in times in NODE.

VTIMEZONES should be a list of the icalendar-vtimezone components in the calendar containing NODE. NODE can be any iCalendar syntax node. If NODE is a property node with an icalendar-tzidparam parameter and an icalendar-date-time or icalendar-period value, the appropriate time zone observance for its value is looked up in VTIMEZONES, and used to set the zone and dst slots in its value. Otherwise, the function is called recursively on NODE's children.

Source Code

;; Defined in /usr/src/emacs/lisp/calendar/icalendar-recur.el.gz
(defun icr:tz-set-zones-in (vtimezones node)
  "Recursively set time zone offset and dst flags in times in NODE.

VTIMEZONES should be a list of the `icalendar-vtimezone' components in
the calendar containing NODE.  NODE can be any iCalendar syntax node.  If
NODE is a property node with an `icalendar-tzidparam' parameter and an
`icalendar-date-time' or `icalendar-period' value, the appropriate time
zone observance for its value is looked up in VTIMEZONES, and used to
set the zone and dst slots in its value.  Otherwise, the function is
called recursively on NODE's children."
  (cond
   ((ical:property-node-p node)
    (ical:with-property node
      ((ical:tzidparam :value tzid))
      (when (and tzid (eq value-type 'ical:date-time))
        (let* ((tz (icr:tz-for tzid vtimezones))
               updated)
          (cond ((eq value-type 'ical:date-time)
                 (setq updated (icr:tz-set-zone value tz)))
                ((eq value-type 'ical:period)
                 (setq updated
                       (ical:make-period
                        (icr:tz-set-zone (ical:period-start value) tz)
                        :end
                        (if (ical:period--defined-end value)
                            (icr:tz-set-zone (ical:period--defined-end value) tz)
                          (ical:period-end value tz))
                        :duration (ical:period-dur-value value)))))
          (ical:ast-node-set-value value-node updated)))))
   ((ical:component-node-p node) ; includes VCALENDAR nodes
    (dolist (nd (ical:ast-node-children node))
      (icr:tz-set-zones-in vtimezones nd)))
   (t nil)))