Function: diary-icalendar-convert-time-via-strategy

diary-icalendar-convert-time-via-strategy is a byte-compiled function defined in diary-icalendar.el.gz.

Signature

(diary-icalendar-convert-time-via-strategy DT &optional VTIMEZONE)

Documentation

Reinterpret the local time DT per the time zone export strategy.

The export strategy is determined by diary-icalendar-time-zone-export-strategy, which see.

DT may be an icalendar-date or icalendar-date-time. If it is a date, it is returned unmodified. If it is a date-time, depending on the strategy and any existing zone information in DT, it will be converted to a correct local, UTC, or floating time. VTIMEZONE should be the icalendar-vtimezone which defines the local time zone, if the time zone export strategy requires it.

Source Code

;; Defined in /usr/src/emacs/lisp/calendar/diary-icalendar.el.gz
(defun di:convert-time-via-strategy (dt &optional vtimezone)
  "Reinterpret the local time DT per the time zone export strategy.

The export strategy is determined by
`diary-icalendar-time-zone-export-strategy', which see.

DT may be an `icalendar-date' or `icalendar-date-time'.  If it is a
date, it is returned unmodified.  If it is a date-time, depending on the
strategy and any existing zone information in DT, it will be converted
to a correct local, UTC, or floating time.  VTIMEZONE should be the
`icalendar-vtimezone' which defines the local time zone, if the time
zone export strategy requires it."
  (cl-typecase dt
    (ical:date dt)
    (ical:date-time
     (cond
       ((or (and (eq 'local di:time-zone-export-strategy)
                 (not (di:-tz-is-utc-p)))
            (listp di:time-zone-export-strategy))
        (unless (ical:vtimezone-component-p vtimezone)
          (di:signal-export-error
           (format
            "%s time export strategy requires a time zone definition;\n%s"
            (if (eq 'local di:time-zone-export-strategy) "`local'" "list-based")
            (concat
             "check the value of `diary-icalendar-time-zone-export-strategy'\n"
             "and the output of `calendar-current-time-zone'"))))
        (if (decoded-time-zone dt)
            (icr:tz-decode-time (encode-time dt) vtimezone)
          (icr:tz-set-zone dt vtimezone :error)))
       ((or (eq 'to-utc di:time-zone-export-strategy)
            (di:-tz-is-utc-p))
        (icr:tz-decode-time (encode-time dt) t)) ; ensure dt is in UTC
       ((eq 'floating di:time-zone-export-strategy)
        (setf (decoded-time-zone dt) nil)
        dt)))))