Function: diary-icalendar-format-time-as-local

diary-icalendar-format-time-as-local is a byte-compiled function defined in diary-icalendar.el.gz.

Signature

(diary-icalendar-format-time-as-local DT &optional ORIGINAL-TZNAME)

Documentation

Format the time in icalendar-date-time DT for the diary.

DT is translated to the system local time zone if necessary, and the original time specification is preserved in parentheses if it was given in a different zone. ORIGINAL-TZNAME, if specified, should be a string naming the time zone observance in which DT was originally encoded in the iCalendar data.

Source Code

;; Defined in /usr/src/emacs/lisp/calendar/diary-icalendar.el.gz
(defun di:format-time-as-local (dt &optional original-tzname)
  "Format the time in `icalendar-date-time' DT for the diary.

DT is translated to the system local time zone if necessary, and the
original time specification is preserved in parentheses if it was given
in a different zone.  ORIGINAL-TZNAME, if specified, should be a string
naming the time zone observance in which DT was originally encoded in
the iCalendar data."
  (cl-typecase dt
    (ical:date "")
    (ical:date-time
     (let* ((ts (encode-time dt))
            (original-offset (decoded-time-zone dt))
            (local-tz (current-time-zone ts))
            (local-offset (car local-tz))
            (local-dt (decode-time ts local-tz))
            (local-str (di:format-time local-dt)))
       (if (and original-tzname original-offset
                (not (eql original-offset local-offset)))
           (format "%s (%s)" local-str (di:format-time dt original-tzname))
         local-str)))))