Function: calendar-dst-find-startend

calendar-dst-find-startend is a byte-compiled function defined in cal-dst.el.gz.

Signature

(calendar-dst-find-startend YEAR)

Documentation

Find the dates in YEAR on which daylight saving time starts and ends.

Returns a list (YEAR START END), where START and END are expressions that when evaluated return the start and end dates, respectively. This function first attempts to use pre-calculated data from calendar-dst-transition-cache, otherwise it calls calendar-dst-find-data (and adds the results to the cache). If dates in YEAR cannot be handled by encode-time (e.g., if they are out of range for POSIX time_t), then rather than an error this function returns the result appropriate for the current year.

Source Code

;; Defined in /usr/src/emacs/lisp/calendar/cal-dst.el.gz
(defun calendar-dst-find-startend (year)
  "Find the dates in YEAR on which daylight saving time starts and ends.
Returns a list (YEAR START END), where START and END are
expressions that when evaluated return the start and end dates,
respectively.  This function first attempts to use pre-calculated
data from `calendar-dst-transition-cache', otherwise it calls
`calendar-dst-find-data' (and adds the results to the cache).
If dates in YEAR cannot be handled by `encode-time' (e.g.,
if they are out of range for POSIX time_t), then rather
than an error this function returns the result appropriate for
the current year."
  (let ((e (assoc year calendar-dst-transition-cache))
        f)
    (or e
        (progn
          (setq e (calendar-dst-find-data
                   (condition-case nil
                       (encode-time 1 0 0 1 1 year)
                     (error
                      (encode-time 1 0 0 1 1
                                   (decoded-time-year (decode-time))))))
                f (nth 4 e)
                e (list year f (nth 5 e))
                calendar-dst-transition-cache
                (append calendar-dst-transition-cache (list e)))
          e))))