Function: math-std-daylight-savings-old

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

Signature

(math-std-daylight-savings-old DATE DT ZONE BUMP)

Documentation

Standard North American daylight saving algorithm before 2007.

This implements the rules for the U.S. and Canada. Daylight saving begins on the first Sunday of April at 2 a.m., and ends on the last Sunday of October at 2 a.m.

Source Code

;; Defined in /usr/src/emacs/lisp/calc/calc-forms.el.gz
(defun math-std-daylight-savings-old (date dt _zone bump)
  "Standard North American daylight saving algorithm before 2007.
This implements the rules for the U.S. and Canada.
Daylight saving begins on the first Sunday of April at 2 a.m.,
and ends on the last Sunday of October at 2 a.m."
  (cond ((< (nth 1 dt) 4) 0)
	((= (nth 1 dt) 4)
	 (let ((sunday (math-prev-weekday-in-month date dt 7 0)))
	   (cond ((< (nth 2 dt) sunday) 0)
		 ((= (nth 2 dt) sunday)
		  (if (>= (nth 3 dt) (+ 3 bump)) -1 0))
		 (t -1))))
	((< (nth 1 dt) 10) -1)
	((= (nth 1 dt) 10)
	 (let ((sunday (math-prev-weekday-in-month date dt 31 0)))
	   (cond ((< (nth 2 dt) sunday) -1)
		 ((= (nth 2 dt) sunday)
		  (if (>= (nth 3 dt) (+ 2 bump)) 0 -1))
		 (t 0))))
	(t 0)))