Function: calendar-dst-find-data
calendar-dst-find-data is a byte-compiled function defined in
cal-dst.el.gz.
Signature
(calendar-dst-find-data &optional TIME)
Documentation
Find data on the first daylight saving time transitions after TIME.
TIME defaults to the current time. Return value is as described
for calendar-current-time-zone.
Source Code
;; Defined in /usr/src/emacs/lisp/calendar/cal-dst.el.gz
;; TODO it might be better to extract this information directly from
;; the system timezone database. But cross-platform...?
;; See thread
;; https://lists.gnu.org/r/emacs-pretest-bug/2006-11/msg00060.html
(defun calendar-dst-find-data (&optional time)
"Find data on the first daylight saving time transitions after TIME.
TIME defaults to the current time. Return value is as described
for `calendar-current-time-zone'."
(let* ((t0 (or time (current-time)))
(t0-zone (current-time-zone t0))
(t0-utc-diff (car t0-zone))
(t0-name (cadr t0-zone)))
(if (not t0-utc-diff)
;; Little or no time zone information is available.
(list nil nil t0-name t0-name nil nil nil nil)
(let* ((t1 (calendar-next-time-zone-transition t0))
(t2 (and t1 (calendar-next-time-zone-transition t1))))
(if (not t2)
;; This locale does not have daylight saving time.
(list (/ t0-utc-diff 60) 0 t0-name t0-name nil nil 0 0)
;; Use heuristics to find daylight saving parameters.
(let* ((t1-zone (current-time-zone t1))
(t1-utc-diff (car t1-zone))
(t1-name (cadr t1-zone))
(t1-date-sec (calendar-absolute-from-time t1 t0-utc-diff))
(t2-date-sec (calendar-absolute-from-time t2 t1-utc-diff))
;; TODO When calendar-dst-check-each-year-flag is non-nil,
;; the rules can be simpler than they currently are.
(t1-rules (calendar-time-zone-daylight-rules
(car t1-date-sec) t0-utc-diff))
(t2-rules (calendar-time-zone-daylight-rules
(car t2-date-sec) t1-utc-diff))
(t1-time (/ (cdr t1-date-sec) 60))
(t2-time (/ (cdr t2-date-sec) 60)))
(if (decoded-time-dst (decode-time t1))
(list (/ t0-utc-diff 60) (/ (- t1-utc-diff t0-utc-diff) 60)
t0-name t1-name t1-rules t2-rules t1-time t2-time)
(list (/ t1-utc-diff 60) (/ (- t0-utc-diff t1-utc-diff) 60)
t1-name t0-name t2-rules t1-rules t2-time t1-time))))))))