diff options
| author | Paul Eggert | 1996-12-19 01:17:26 +0000 |
|---|---|---|
| committer | Paul Eggert | 1996-12-19 01:17:26 +0000 |
| commit | 12154b449fc01a19f9d3310ca68a09e4ea2b963a (patch) | |
| tree | 0fe783ba93bbca74e9e64f697aec675a3b810385 | |
| parent | ae4eb03ccbef490ff286f86867a643af3dafaf41 (diff) | |
| download | emacs-12154b449fc01a19f9d3310ca68a09e4ea2b963a.tar.gz emacs-12154b449fc01a19f9d3310ca68a09e4ea2b963a.zip | |
(calendar-time-zone-daylight-rules): Add support
for daylight saving rules in Iran.
(require 'cal-persia) now needed.
| -rw-r--r-- | lisp/calendar/cal-dst.el | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/lisp/calendar/cal-dst.el b/lisp/calendar/cal-dst.el index ced3ef5c68d..3e33f6cb9f3 100644 --- a/lisp/calendar/cal-dst.el +++ b/lisp/calendar/cal-dst.el | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | ;;; cal-dst.el --- calendar functions for daylight savings rules. | 1 | ;;; cal-dst.el --- calendar functions for daylight savings rules. |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1993, 1994, 1995 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 1993, 1994, 1995, 1996 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; Author: Paul Eggert <eggert@twinsun.com> | 5 | ;; Author: Paul Eggert <eggert@twinsun.com> |
| 6 | ;; Edward M. Reingold <reingold@cs.uiuc.edu> | 6 | ;; Edward M. Reingold <reingold@cs.uiuc.edu> |
| @@ -38,6 +38,7 @@ | |||
| 38 | ;;; Code: | 38 | ;;; Code: |
| 39 | 39 | ||
| 40 | (require 'calendar) | 40 | (require 'calendar) |
| 41 | (require 'cal-persia) | ||
| 41 | 42 | ||
| 42 | (defvar calendar-current-time-zone-cache nil | 43 | (defvar calendar-current-time-zone-cache nil |
| 43 | "Cache for result of calendar-current-time-zone.") | 44 | "Cache for result of calendar-current-time-zone.") |
| @@ -128,7 +129,7 @@ Return nil if no such transition can be found." | |||
| 128 | 129 | ||
| 129 | (defun calendar-time-zone-daylight-rules (abs-date utc-diff) | 130 | (defun calendar-time-zone-daylight-rules (abs-date utc-diff) |
| 130 | "Return daylight transition rule for ABS-DATE, UTC-DIFF sec offset from UTC. | 131 | "Return daylight transition rule for ABS-DATE, UTC-DIFF sec offset from UTC. |
| 131 | ABS-DIFF must specify a day that contains a daylight savings transition. | 132 | ABS-DATE must specify a day that contains a daylight savings transition. |
| 132 | The result has the proper form for calendar-daylight-savings-starts'." | 133 | The result has the proper form for calendar-daylight-savings-starts'." |
| 133 | (let* ((date (calendar-gregorian-from-absolute abs-date)) | 134 | (let* ((date (calendar-gregorian-from-absolute abs-date)) |
| 134 | (weekday (% abs-date 7)) | 135 | (weekday (% abs-date 7)) |
| @@ -153,7 +154,16 @@ The result has the proper form for calendar-daylight-savings-starts'." | |||
| 153 | (cons | 154 | (cons |
| 154 | (list 'calendar-nth-named-day 1 weekday m 'year j) | 155 | (list 'calendar-nth-named-day 1 weekday m 'year j) |
| 155 | l))) | 156 | l))) |
| 156 | l))) | 157 | l) |
| 158 | ;; 01-01 and 07-01 for this year's Persian calendar. | ||
| 159 | (if (and (= m 3) (<= 20 d) (<= d 21)) | ||
| 160 | '((calendar-gregorian-from-absolute | ||
| 161 | (calendar-absolute-from-persian | ||
| 162 | (list 1 1 (- year 621)))))) | ||
| 163 | (if (and (= m 9) (<= 22 d) (<= d 23)) | ||
| 164 | '((calendar-gregorian-from-absolute | ||
| 165 | (calendar-absolute-from-persian | ||
| 166 | (list 7 1 (- year 621)))))))) | ||
| 157 | (prevday-sec (- -1 utc-diff)) ;; last sec of previous local day | 167 | (prevday-sec (- -1 utc-diff)) ;; last sec of previous local day |
| 158 | (year (1+ y))) | 168 | (year (1+ y))) |
| 159 | ;; Scan through the next few years until only one rule remains. | 169 | ;; Scan through the next few years until only one rule remains. |