]> code.delx.au - gnu-emacs/commitdiff
(calendar-time-zone-daylight-rules): Add support
authorPaul Eggert <eggert@twinsun.com>
Thu, 19 Dec 1996 01:17:26 +0000 (01:17 +0000)
committerPaul Eggert <eggert@twinsun.com>
Thu, 19 Dec 1996 01:17:26 +0000 (01:17 +0000)
for daylight saving rules in Iran.
(require 'cal-persia) now needed.

lisp/calendar/cal-dst.el

index ced3ef5c68d004002cbb1c6a59ce6a77dbcb8588..3e33f6cb9f355ab84c67efa33eca8957420eec3d 100644 (file)
@@ -1,6 +1,6 @@
 ;;; cal-dst.el --- calendar functions for daylight savings rules.
 
-;; Copyright (C) 1993, 1994, 1995 Free Software Foundation, Inc.
+;; Copyright (C) 1993, 1994, 1995, 1996 Free Software Foundation, Inc.
 
 ;; Author: Paul Eggert <eggert@twinsun.com>
 ;;     Edward M. Reingold <reingold@cs.uiuc.edu>
@@ -38,6 +38,7 @@
 ;;; Code:
 
 (require 'calendar)
+(require 'cal-persia)
 
 (defvar calendar-current-time-zone-cache nil
   "Cache for result of calendar-current-time-zone.")
@@ -128,7 +129,7 @@ Return nil if no such transition can be found."
 
 (defun calendar-time-zone-daylight-rules (abs-date utc-diff)
   "Return daylight transition rule for ABS-DATE, UTC-DIFF sec offset from UTC.
-ABS-DIFF must specify a day that contains a daylight savings transition.
+ABS-DATE must specify a day that contains a daylight savings transition.
 The result has the proper form for calendar-daylight-savings-starts'."
   (let* ((date (calendar-gregorian-from-absolute abs-date))
         (weekday (% abs-date 7))
@@ -153,7 +154,16 @@ The result has the proper form for calendar-daylight-savings-starts'."
                      (cons
                       (list 'calendar-nth-named-day 1 weekday m 'year j)
                       l)))
-            l)))
+            l)
+          ;; 01-01 and 07-01 for this year's Persian calendar.
+          (if (and (= m 3) (<= 20 d) (<= d 21))
+              '((calendar-gregorian-from-absolute
+                 (calendar-absolute-from-persian
+                  (list 1 1 (- year 621))))))
+          (if (and (= m 9) (<= 22 d) (<= d 23))
+              '((calendar-gregorian-from-absolute
+                 (calendar-absolute-from-persian
+                  (list 7 1 (- year 621))))))))
         (prevday-sec (- -1 utc-diff)) ;; last sec of previous local day
         (year (1+ y)))
     ;; Scan through the next few years until only one rule remains.