Function: math-cal-daylight-savings-adjust

math-cal-daylight-savings-adjust is a byte-compiled function defined in calc-forms.el.gz.

Signature

(math-cal-daylight-savings-adjust DATE)

Documentation

Return -1 if DATE is using daylight saving, 0 otherwise.

Source Code

;; Defined in /usr/src/emacs/lisp/calc/calc-forms.el.gz
;;; Based on part of dst-adjust-time in cal-dst.el
;;; For calcFunc-dst, when zone=nil
(defun math-cal-daylight-savings-adjust (date)
  "Return -1 if DATE is using daylight saving, 0 otherwise."
  (require 'cal-dst)
  (unless date (setq date (calcFunc-now)))
  (let* ((dt (math-date-to-dt date))
         (time (cond
                ((nth 3 dt)
                 (nth 3 dt))
                ((nth 4 dt)
                 (+ (nth 3 dt) (/ (nth 4 dt) 60.0)))
                (t
                 0)))
         (rounded-abs-date
          (+
           (calendar-absolute-from-gregorian
            (list (nth 1 dt) (nth 2 dt) (nth 0 dt)))
           (/ (round (* 60 time)) 60.0 24.0))))
    (if (dst-in-effect rounded-abs-date)
        -1
      0)))