Mercurial > emacs
annotate lisp/calendar/cal-dst.el @ 72772:caccf1b92ded
(Fx_file_dialog): Remove unused variable `f'. Call check_mac.
author | YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> |
---|---|
date | Sun, 10 Sep 2006 05:51:45 +0000 |
parents | 8daf7d9a0771 |
children | be323d585de0 4b3d39451150 |
rev | line source |
---|---|
38422
7a94f1c588c4
Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents:
16726
diff
changeset
|
1 ;;; cal-dst.el --- calendar functions for daylight savings rules |
3872 | 2 |
68721 | 3 ;; Copyright (C) 1993, 1994, 1995, 1996, 2001, 2002, 2003, 2004, 2005, |
4 ;; 2006 Free Software Foundation, Inc. | |
3872 | 5 |
6 ;; Author: Paul Eggert <eggert@twinsun.com> | |
7 ;; Edward M. Reingold <reingold@cs.uiuc.edu> | |
67465
a55ee709ec8d
Update copyright pending Emacs 22.
Glenn Morris <rgm@gnu.org>
parents:
64085
diff
changeset
|
8 ;; Maintainer: Glenn Morris <rgm@gnu.org> |
3872 | 9 ;; Keywords: calendar |
10 ;; Human-Keywords: daylight savings time, calendar, diary, holidays | |
11 | |
12 ;; This file is part of GNU Emacs. | |
13 | |
6736
3e1323443b1a
Fix copying conditions for current GPL version.
Richard M. Stallman <rms@gnu.org>
parents:
6735
diff
changeset
|
14 ;; GNU Emacs is free software; you can redistribute it and/or modify |
3e1323443b1a
Fix copying conditions for current GPL version.
Richard M. Stallman <rms@gnu.org>
parents:
6735
diff
changeset
|
15 ;; it under the terms of the GNU General Public License as published by |
3e1323443b1a
Fix copying conditions for current GPL version.
Richard M. Stallman <rms@gnu.org>
parents:
6735
diff
changeset
|
16 ;; the Free Software Foundation; either version 2, or (at your option) |
3e1323443b1a
Fix copying conditions for current GPL version.
Richard M. Stallman <rms@gnu.org>
parents:
6735
diff
changeset
|
17 ;; any later version. |
3872 | 18 |
6736
3e1323443b1a
Fix copying conditions for current GPL version.
Richard M. Stallman <rms@gnu.org>
parents:
6735
diff
changeset
|
19 ;; GNU Emacs is distributed in the hope that it will be useful, |
3e1323443b1a
Fix copying conditions for current GPL version.
Richard M. Stallman <rms@gnu.org>
parents:
6735
diff
changeset
|
20 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
3e1323443b1a
Fix copying conditions for current GPL version.
Richard M. Stallman <rms@gnu.org>
parents:
6735
diff
changeset
|
21 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3e1323443b1a
Fix copying conditions for current GPL version.
Richard M. Stallman <rms@gnu.org>
parents:
6735
diff
changeset
|
22 ;; GNU General Public License for more details. |
3e1323443b1a
Fix copying conditions for current GPL version.
Richard M. Stallman <rms@gnu.org>
parents:
6735
diff
changeset
|
23 |
3e1323443b1a
Fix copying conditions for current GPL version.
Richard M. Stallman <rms@gnu.org>
parents:
6735
diff
changeset
|
24 ;; You should have received a copy of the GNU General Public License |
14169 | 25 ;; along with GNU Emacs; see the file COPYING. If not, write to the |
64085 | 26 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
27 ;; Boston, MA 02110-1301, USA. | |
3872 | 28 |
29 ;;; Commentary: | |
30 | |
31 ;; This collection of functions implements the features of calendar.el and | |
32 ;; holiday.el that deal with daylight savings time. | |
33 | |
34 ;; Comments, corrections, and improvements should be sent to | |
35 ;; Edward M. Reingold Department of Computer Science | |
36 ;; (217) 333-6733 University of Illinois at Urbana-Champaign | |
37 ;; reingold@cs.uiuc.edu 1304 West Springfield Avenue | |
38 ;; Urbana, Illinois 61801 | |
39 | |
40 ;;; Code: | |
41 | |
42 (require 'calendar) | |
16726
475649bca297
(calendar-time-zone-daylight-rules): Add support
Paul Eggert <eggert@twinsun.com>
parents:
14169
diff
changeset
|
43 (require 'cal-persia) |
3872 | 44 |
45 (defvar calendar-current-time-zone-cache nil | |
46 "Cache for result of calendar-current-time-zone.") | |
47 | |
48 (defvar calendar-system-time-basis | |
49 (calendar-absolute-from-gregorian '(1 1 1970)) | |
50 "Absolute date of starting date of system clock.") | |
51 | |
52 (defun calendar-absolute-from-time (x utc-diff) | |
53 "Absolute local date of time X; local time is UTC-DIFF seconds from UTC. | |
54 | |
55 X is (HIGH . LOW) or (HIGH LOW . IGNORED) where HIGH and LOW are the | |
56 high and low 16 bits, respectively, of the number of seconds since | |
57 1970-01-01 00:00:00 UTC, ignoring leap seconds. | |
58 | |
59 Returns the pair (ABS-DATE . SECONDS) where SECONDS after local midnight on | |
60 absolute date ABS-DATE is the equivalent moment to X." | |
61 (let* ((h (car x)) | |
62 (xtail (cdr x)) | |
63 (l (+ utc-diff (if (numberp xtail) xtail (car xtail)))) | |
4535 | 64 (u (+ (* 512 (mod h 675)) (floor l 128)))) |
3872 | 65 ;; Overflow is a terrible thing! |
66 (cons (+ calendar-system-time-basis | |
67 ;; floor((2^16 h +l) / (60*60*24)) | |
4659
031aaf217dc3
(calendar-time-zone-daylight-rules): Scan through the
Paul Eggert <eggert@twinsun.com>
parents:
4535
diff
changeset
|
68 (* 512 (floor h 675)) (floor u 675)) |
5001
f3a55af8f584
(calendar-absolute-from-time): Undo Sep 14 patch.
Richard M. Stallman <rms@gnu.org>
parents:
4756
diff
changeset
|
69 ;; (2^16 h +l) mod (60*60*24) |
f3a55af8f584
(calendar-absolute-from-time): Undo Sep 14 patch.
Richard M. Stallman <rms@gnu.org>
parents:
4756
diff
changeset
|
70 (+ (* (mod u 675) 128) (mod l 128))))) |
3872 | 71 |
72 (defun calendar-time-from-absolute (abs-date s) | |
73 "Time of absolute date ABS-DATE, S seconds after midnight. | |
74 | |
56425
5572efece9a6
(calendar-time-from-absolute): Return a list of two integers, instead
Luc Teirlinck <teirllm@auburn.edu>
parents:
52401
diff
changeset
|
75 Returns the list (HIGH LOW) where HIGH and LOW are the high and low |
3872 | 76 16 bits, respectively, of the number of seconds 1970-01-01 00:00:00 UTC, |
77 ignoring leap seconds, that is the equivalent moment to S seconds after | |
78 midnight UTC on absolute date ABS-DATE." | |
79 (let* ((a (- abs-date calendar-system-time-basis)) | |
4535 | 80 (u (+ (* 163 (mod a 512)) (floor s 128)))) |
3872 | 81 ;; Overflow is a terrible thing! |
56425
5572efece9a6
(calendar-time-from-absolute): Return a list of two integers, instead
Luc Teirlinck <teirllm@auburn.edu>
parents:
52401
diff
changeset
|
82 (list |
5001
f3a55af8f584
(calendar-absolute-from-time): Undo Sep 14 patch.
Richard M. Stallman <rms@gnu.org>
parents:
4756
diff
changeset
|
83 ;; floor((60*60*24*a + s) / 2^16) |
4535 | 84 (+ a (* 163 (floor a 512)) (floor u 512)) |
5001
f3a55af8f584
(calendar-absolute-from-time): Undo Sep 14 patch.
Richard M. Stallman <rms@gnu.org>
parents:
4756
diff
changeset
|
85 ;; (60*60*24*a + s) mod 2^16 |
4535 | 86 (+ (* 128 (mod u 512)) (mod s 128))))) |
3872 | 87 |
88 (defun calendar-next-time-zone-transition (time) | |
89 "Return the time of the next time zone transition after TIME. | |
90 Both TIME and the result are acceptable arguments to current-time-zone. | |
91 Return nil if no such transition can be found." | |
92 (let* ((base 65536);; 2^16 = base of current-time output | |
93 (quarter-multiple 120);; approx = (seconds per quarter year) / base | |
94 (time-zone (current-time-zone time)) | |
95 (time-utc-diff (car time-zone)) | |
96 hi | |
97 hi-zone | |
98 (hi-utc-diff time-utc-diff) | |
99 (quarters '(2 1 3))) | |
100 ;; Heuristic: probe the time zone offset in the next three calendar | |
101 ;; quarters, looking for a time zone offset different from TIME. | |
102 (while (and quarters (eq time-utc-diff hi-utc-diff)) | |
103 (setq hi (cons (+ (car time) (* (car quarters) quarter-multiple)) 0)) | |
104 (setq hi-zone (current-time-zone hi)) | |
105 (setq hi-utc-diff (car hi-zone)) | |
106 (setq quarters (cdr quarters))) | |
107 (and | |
108 time-utc-diff | |
109 hi-utc-diff | |
110 (not (eq time-utc-diff hi-utc-diff)) | |
111 ;; Now HI is after the next time zone transition. | |
112 ;; Set LO to TIME, and then binary search to increase LO and decrease HI | |
113 ;; until LO is just before and HI is just after the time zone transition. | |
114 (let* ((tail (cdr time)) | |
115 (lo (cons (car time) (if (numberp tail) tail (car tail)))) | |
116 probe) | |
117 (while | |
118 ;; Set PROBE to halfway between LO and HI, rounding down. | |
119 ;; If PROBE equals LO, we are done. | |
120 (let* ((lsum (+ (cdr lo) (cdr hi))) | |
121 (hsum (+ (car lo) (car hi) (/ lsum base))) | |
122 (hsumodd (logand 1 hsum))) | |
123 (setq probe (cons (/ (- hsum hsumodd) 2) | |
124 (/ (+ (* hsumodd base) (% lsum base)) 2))) | |
125 (not (equal lo probe))) | |
126 ;; Set either LO or HI to PROBE, depending on probe results. | |
127 (if (eq (car (current-time-zone probe)) hi-utc-diff) | |
128 (setq hi probe) | |
129 (setq lo probe))) | |
130 hi)))) | |
131 | |
132 (defun calendar-time-zone-daylight-rules (abs-date utc-diff) | |
133 "Return daylight transition rule for ABS-DATE, UTC-DIFF sec offset from UTC. | |
16726
475649bca297
(calendar-time-zone-daylight-rules): Add support
Paul Eggert <eggert@twinsun.com>
parents:
14169
diff
changeset
|
134 ABS-DATE must specify a day that contains a daylight savings transition. |
3872 | 135 The result has the proper form for calendar-daylight-savings-starts'." |
136 (let* ((date (calendar-gregorian-from-absolute abs-date)) | |
137 (weekday (% abs-date 7)) | |
138 (m (extract-calendar-month date)) | |
139 (d (extract-calendar-day date)) | |
140 (y (extract-calendar-year date)) | |
141 (last (calendar-last-day-of-month m y)) | |
142 (candidate-rules | |
143 (append | |
144 ;; Day D of month M. | |
145 (list (list 'list m d 'year)) | |
146 ;; The first WEEKDAY of month M. | |
147 (if (< d 8) | |
148 (list (list 'calendar-nth-named-day 1 weekday m 'year))) | |
149 ;; The last WEEKDAY of month M. | |
150 (if (> d (- last 7)) | |
151 (list (list 'calendar-nth-named-day -1 weekday m 'year))) | |
152 ;; The first WEEKDAY after day J of month M, for D-6 < J <= D. | |
153 (let (l) | |
154 (calendar-for-loop j from (max 2 (- d 6)) to (min d (- last 8)) do | |
155 (setq l | |
156 (cons | |
157 (list 'calendar-nth-named-day 1 weekday m 'year j) | |
158 l))) | |
16726
475649bca297
(calendar-time-zone-daylight-rules): Add support
Paul Eggert <eggert@twinsun.com>
parents:
14169
diff
changeset
|
159 l) |
475649bca297
(calendar-time-zone-daylight-rules): Add support
Paul Eggert <eggert@twinsun.com>
parents:
14169
diff
changeset
|
160 ;; 01-01 and 07-01 for this year's Persian calendar. |
475649bca297
(calendar-time-zone-daylight-rules): Add support
Paul Eggert <eggert@twinsun.com>
parents:
14169
diff
changeset
|
161 (if (and (= m 3) (<= 20 d) (<= d 21)) |
475649bca297
(calendar-time-zone-daylight-rules): Add support
Paul Eggert <eggert@twinsun.com>
parents:
14169
diff
changeset
|
162 '((calendar-gregorian-from-absolute |
475649bca297
(calendar-time-zone-daylight-rules): Add support
Paul Eggert <eggert@twinsun.com>
parents:
14169
diff
changeset
|
163 (calendar-absolute-from-persian |
475649bca297
(calendar-time-zone-daylight-rules): Add support
Paul Eggert <eggert@twinsun.com>
parents:
14169
diff
changeset
|
164 (list 1 1 (- year 621)))))) |
475649bca297
(calendar-time-zone-daylight-rules): Add support
Paul Eggert <eggert@twinsun.com>
parents:
14169
diff
changeset
|
165 (if (and (= m 9) (<= 22 d) (<= d 23)) |
475649bca297
(calendar-time-zone-daylight-rules): Add support
Paul Eggert <eggert@twinsun.com>
parents:
14169
diff
changeset
|
166 '((calendar-gregorian-from-absolute |
475649bca297
(calendar-time-zone-daylight-rules): Add support
Paul Eggert <eggert@twinsun.com>
parents:
14169
diff
changeset
|
167 (calendar-absolute-from-persian |
475649bca297
(calendar-time-zone-daylight-rules): Add support
Paul Eggert <eggert@twinsun.com>
parents:
14169
diff
changeset
|
168 (list 7 1 (- year 621)))))))) |
3872 | 169 (prevday-sec (- -1 utc-diff)) ;; last sec of previous local day |
4659
031aaf217dc3
(calendar-time-zone-daylight-rules): Scan through the
Paul Eggert <eggert@twinsun.com>
parents:
4535
diff
changeset
|
170 (year (1+ y))) |
031aaf217dc3
(calendar-time-zone-daylight-rules): Scan through the
Paul Eggert <eggert@twinsun.com>
parents:
4535
diff
changeset
|
171 ;; Scan through the next few years until only one rule remains. |
031aaf217dc3
(calendar-time-zone-daylight-rules): Scan through the
Paul Eggert <eggert@twinsun.com>
parents:
4535
diff
changeset
|
172 (while |
031aaf217dc3
(calendar-time-zone-daylight-rules): Scan through the
Paul Eggert <eggert@twinsun.com>
parents:
4535
diff
changeset
|
173 (let ((rules candidate-rules) |
031aaf217dc3
(calendar-time-zone-daylight-rules): Scan through the
Paul Eggert <eggert@twinsun.com>
parents:
4535
diff
changeset
|
174 new-rules) |
031aaf217dc3
(calendar-time-zone-daylight-rules): Scan through the
Paul Eggert <eggert@twinsun.com>
parents:
4535
diff
changeset
|
175 (while |
031aaf217dc3
(calendar-time-zone-daylight-rules): Scan through the
Paul Eggert <eggert@twinsun.com>
parents:
4535
diff
changeset
|
176 (let* |
031aaf217dc3
(calendar-time-zone-daylight-rules): Scan through the
Paul Eggert <eggert@twinsun.com>
parents:
4535
diff
changeset
|
177 ((rule (car rules)) |
031aaf217dc3
(calendar-time-zone-daylight-rules): Scan through the
Paul Eggert <eggert@twinsun.com>
parents:
4535
diff
changeset
|
178 (date |
031aaf217dc3
(calendar-time-zone-daylight-rules): Scan through the
Paul Eggert <eggert@twinsun.com>
parents:
4535
diff
changeset
|
179 ;; The following is much faster than |
031aaf217dc3
(calendar-time-zone-daylight-rules): Scan through the
Paul Eggert <eggert@twinsun.com>
parents:
4535
diff
changeset
|
180 ;; (calendar-absolute-from-gregorian (eval rule)). |
031aaf217dc3
(calendar-time-zone-daylight-rules): Scan through the
Paul Eggert <eggert@twinsun.com>
parents:
4535
diff
changeset
|
181 (cond ((eq (car rule) 'calendar-nth-named-day) |
031aaf217dc3
(calendar-time-zone-daylight-rules): Scan through the
Paul Eggert <eggert@twinsun.com>
parents:
4535
diff
changeset
|
182 (eval (cons 'calendar-nth-named-absday (cdr rule)))) |
031aaf217dc3
(calendar-time-zone-daylight-rules): Scan through the
Paul Eggert <eggert@twinsun.com>
parents:
4535
diff
changeset
|
183 ((eq (car rule) 'calendar-gregorian-from-absolute) |
031aaf217dc3
(calendar-time-zone-daylight-rules): Scan through the
Paul Eggert <eggert@twinsun.com>
parents:
4535
diff
changeset
|
184 (eval (car (cdr rule)))) |
031aaf217dc3
(calendar-time-zone-daylight-rules): Scan through the
Paul Eggert <eggert@twinsun.com>
parents:
4535
diff
changeset
|
185 (t (let ((g (eval rule))) |
031aaf217dc3
(calendar-time-zone-daylight-rules): Scan through the
Paul Eggert <eggert@twinsun.com>
parents:
4535
diff
changeset
|
186 (calendar-absolute-from-gregorian g)))))) |
031aaf217dc3
(calendar-time-zone-daylight-rules): Scan through the
Paul Eggert <eggert@twinsun.com>
parents:
4535
diff
changeset
|
187 (or (equal |
031aaf217dc3
(calendar-time-zone-daylight-rules): Scan through the
Paul Eggert <eggert@twinsun.com>
parents:
4535
diff
changeset
|
188 (current-time-zone |
031aaf217dc3
(calendar-time-zone-daylight-rules): Scan through the
Paul Eggert <eggert@twinsun.com>
parents:
4535
diff
changeset
|
189 (calendar-time-from-absolute date prevday-sec)) |
031aaf217dc3
(calendar-time-zone-daylight-rules): Scan through the
Paul Eggert <eggert@twinsun.com>
parents:
4535
diff
changeset
|
190 (current-time-zone |
031aaf217dc3
(calendar-time-zone-daylight-rules): Scan through the
Paul Eggert <eggert@twinsun.com>
parents:
4535
diff
changeset
|
191 (calendar-time-from-absolute (1+ date) prevday-sec))) |
031aaf217dc3
(calendar-time-zone-daylight-rules): Scan through the
Paul Eggert <eggert@twinsun.com>
parents:
4535
diff
changeset
|
192 (setq new-rules (cons rule new-rules))) |
031aaf217dc3
(calendar-time-zone-daylight-rules): Scan through the
Paul Eggert <eggert@twinsun.com>
parents:
4535
diff
changeset
|
193 (setq rules (cdr rules)))) |
031aaf217dc3
(calendar-time-zone-daylight-rules): Scan through the
Paul Eggert <eggert@twinsun.com>
parents:
4535
diff
changeset
|
194 ;; If no rules remain, just use the first candidate rule; |
031aaf217dc3
(calendar-time-zone-daylight-rules): Scan through the
Paul Eggert <eggert@twinsun.com>
parents:
4535
diff
changeset
|
195 ;; it's wrong in general, but it's right for at least one year. |
031aaf217dc3
(calendar-time-zone-daylight-rules): Scan through the
Paul Eggert <eggert@twinsun.com>
parents:
4535
diff
changeset
|
196 (setq candidate-rules (if new-rules (nreverse new-rules) |
031aaf217dc3
(calendar-time-zone-daylight-rules): Scan through the
Paul Eggert <eggert@twinsun.com>
parents:
4535
diff
changeset
|
197 (list (car candidate-rules)))) |
031aaf217dc3
(calendar-time-zone-daylight-rules): Scan through the
Paul Eggert <eggert@twinsun.com>
parents:
4535
diff
changeset
|
198 (setq year (1+ year)) |
031aaf217dc3
(calendar-time-zone-daylight-rules): Scan through the
Paul Eggert <eggert@twinsun.com>
parents:
4535
diff
changeset
|
199 (cdr candidate-rules))) |
031aaf217dc3
(calendar-time-zone-daylight-rules): Scan through the
Paul Eggert <eggert@twinsun.com>
parents:
4535
diff
changeset
|
200 (car candidate-rules))) |
3872 | 201 |
202 (defun calendar-current-time-zone () | |
203 "Return UTC difference, dst offset, names and rules for current time zone. | |
204 | |
4659
031aaf217dc3
(calendar-time-zone-daylight-rules): Scan through the
Paul Eggert <eggert@twinsun.com>
parents:
4535
diff
changeset
|
205 Returns (UTC-DIFF DST-OFFSET STD-ZONE DST-ZONE DST-STARTS DST-ENDS |
031aaf217dc3
(calendar-time-zone-daylight-rules): Scan through the
Paul Eggert <eggert@twinsun.com>
parents:
4535
diff
changeset
|
206 DST-STARTS-TIME DST-ENDS-TIME), based on a heuristic probing of what the |
031aaf217dc3
(calendar-time-zone-daylight-rules): Scan through the
Paul Eggert <eggert@twinsun.com>
parents:
4535
diff
changeset
|
207 system knows: |
3872 | 208 |
209 UTC-DIFF is an integer specifying the number of minutes difference between | |
210 standard time in the current time zone and Coordinated Universal Time | |
211 (Greenwich Mean Time). A negative value means west of Greenwich. | |
212 DST-OFFSET is an integer giving the daylight savings time offset in minutes. | |
213 STD-ZONE is a string giving the name of the time zone when no seasonal time | |
214 adjustment is in effect. | |
215 DST-ZONE is a string giving the name of the time zone when there is a seasonal | |
216 time adjustment in effect. | |
217 DST-STARTS and DST-ENDS are sexps in the variable `year' giving the daylight | |
4659
031aaf217dc3
(calendar-time-zone-daylight-rules): Scan through the
Paul Eggert <eggert@twinsun.com>
parents:
4535
diff
changeset
|
218 savings time start and end rules, in the form expected by |
3872 | 219 `calendar-daylight-savings-starts'. |
4659
031aaf217dc3
(calendar-time-zone-daylight-rules): Scan through the
Paul Eggert <eggert@twinsun.com>
parents:
4535
diff
changeset
|
220 DST-STARTS-TIME and DST-ENDS-TIME are integers giving the number of minutes |
031aaf217dc3
(calendar-time-zone-daylight-rules): Scan through the
Paul Eggert <eggert@twinsun.com>
parents:
4535
diff
changeset
|
221 after midnight that daylight savings time starts and ends. |
3872 | 222 |
4659
031aaf217dc3
(calendar-time-zone-daylight-rules): Scan through the
Paul Eggert <eggert@twinsun.com>
parents:
4535
diff
changeset
|
223 If the local area does not use a seasonal time adjustment, STD-ZONE and |
031aaf217dc3
(calendar-time-zone-daylight-rules): Scan through the
Paul Eggert <eggert@twinsun.com>
parents:
4535
diff
changeset
|
224 DST-ZONE are equal, and all the DST-* integer variables are 0. |
3872 | 225 |
226 Some operating systems cannot provide all this information to Emacs; in this | |
227 case, `calendar-current-time-zone' returns a list containing nil for the data | |
228 it can't find." | |
229 (or | |
230 calendar-current-time-zone-cache | |
4659
031aaf217dc3
(calendar-time-zone-daylight-rules): Scan through the
Paul Eggert <eggert@twinsun.com>
parents:
4535
diff
changeset
|
231 (setq |
031aaf217dc3
(calendar-time-zone-daylight-rules): Scan through the
Paul Eggert <eggert@twinsun.com>
parents:
4535
diff
changeset
|
232 calendar-current-time-zone-cache |
031aaf217dc3
(calendar-time-zone-daylight-rules): Scan through the
Paul Eggert <eggert@twinsun.com>
parents:
4535
diff
changeset
|
233 (let* ((t0 (current-time)) |
031aaf217dc3
(calendar-time-zone-daylight-rules): Scan through the
Paul Eggert <eggert@twinsun.com>
parents:
4535
diff
changeset
|
234 (t0-zone (current-time-zone t0)) |
031aaf217dc3
(calendar-time-zone-daylight-rules): Scan through the
Paul Eggert <eggert@twinsun.com>
parents:
4535
diff
changeset
|
235 (t0-utc-diff (car t0-zone)) |
031aaf217dc3
(calendar-time-zone-daylight-rules): Scan through the
Paul Eggert <eggert@twinsun.com>
parents:
4535
diff
changeset
|
236 (t0-name (car (cdr t0-zone)))) |
031aaf217dc3
(calendar-time-zone-daylight-rules): Scan through the
Paul Eggert <eggert@twinsun.com>
parents:
4535
diff
changeset
|
237 (if (not t0-utc-diff) |
031aaf217dc3
(calendar-time-zone-daylight-rules): Scan through the
Paul Eggert <eggert@twinsun.com>
parents:
4535
diff
changeset
|
238 ;; Little or no time zone information is available. |
031aaf217dc3
(calendar-time-zone-daylight-rules): Scan through the
Paul Eggert <eggert@twinsun.com>
parents:
4535
diff
changeset
|
239 (list nil nil t0-name t0-name nil nil nil nil) |
031aaf217dc3
(calendar-time-zone-daylight-rules): Scan through the
Paul Eggert <eggert@twinsun.com>
parents:
4535
diff
changeset
|
240 (let* ((t1 (calendar-next-time-zone-transition t0)) |
031aaf217dc3
(calendar-time-zone-daylight-rules): Scan through the
Paul Eggert <eggert@twinsun.com>
parents:
4535
diff
changeset
|
241 (t2 (and t1 (calendar-next-time-zone-transition t1)))) |
031aaf217dc3
(calendar-time-zone-daylight-rules): Scan through the
Paul Eggert <eggert@twinsun.com>
parents:
4535
diff
changeset
|
242 (if (not t2) |
031aaf217dc3
(calendar-time-zone-daylight-rules): Scan through the
Paul Eggert <eggert@twinsun.com>
parents:
4535
diff
changeset
|
243 ;; This locale does not have daylight savings time. |
031aaf217dc3
(calendar-time-zone-daylight-rules): Scan through the
Paul Eggert <eggert@twinsun.com>
parents:
4535
diff
changeset
|
244 (list (/ t0-utc-diff 60) 0 t0-name t0-name nil nil 0 0) |
031aaf217dc3
(calendar-time-zone-daylight-rules): Scan through the
Paul Eggert <eggert@twinsun.com>
parents:
4535
diff
changeset
|
245 ;; Use heuristics to find daylight savings parameters. |
031aaf217dc3
(calendar-time-zone-daylight-rules): Scan through the
Paul Eggert <eggert@twinsun.com>
parents:
4535
diff
changeset
|
246 (let* ((t1-zone (current-time-zone t1)) |
031aaf217dc3
(calendar-time-zone-daylight-rules): Scan through the
Paul Eggert <eggert@twinsun.com>
parents:
4535
diff
changeset
|
247 (t1-utc-diff (car t1-zone)) |
031aaf217dc3
(calendar-time-zone-daylight-rules): Scan through the
Paul Eggert <eggert@twinsun.com>
parents:
4535
diff
changeset
|
248 (t1-name (car (cdr t1-zone))) |
031aaf217dc3
(calendar-time-zone-daylight-rules): Scan through the
Paul Eggert <eggert@twinsun.com>
parents:
4535
diff
changeset
|
249 (t1-date-sec (calendar-absolute-from-time t1 t0-utc-diff)) |
031aaf217dc3
(calendar-time-zone-daylight-rules): Scan through the
Paul Eggert <eggert@twinsun.com>
parents:
4535
diff
changeset
|
250 (t2-date-sec (calendar-absolute-from-time t2 t1-utc-diff)) |
031aaf217dc3
(calendar-time-zone-daylight-rules): Scan through the
Paul Eggert <eggert@twinsun.com>
parents:
4535
diff
changeset
|
251 (t1-rules (calendar-time-zone-daylight-rules |
031aaf217dc3
(calendar-time-zone-daylight-rules): Scan through the
Paul Eggert <eggert@twinsun.com>
parents:
4535
diff
changeset
|
252 (car t1-date-sec) t0-utc-diff)) |
031aaf217dc3
(calendar-time-zone-daylight-rules): Scan through the
Paul Eggert <eggert@twinsun.com>
parents:
4535
diff
changeset
|
253 (t2-rules (calendar-time-zone-daylight-rules |
031aaf217dc3
(calendar-time-zone-daylight-rules): Scan through the
Paul Eggert <eggert@twinsun.com>
parents:
4535
diff
changeset
|
254 (car t2-date-sec) t1-utc-diff)) |
031aaf217dc3
(calendar-time-zone-daylight-rules): Scan through the
Paul Eggert <eggert@twinsun.com>
parents:
4535
diff
changeset
|
255 (t1-time (/ (cdr t1-date-sec) 60)) |
031aaf217dc3
(calendar-time-zone-daylight-rules): Scan through the
Paul Eggert <eggert@twinsun.com>
parents:
4535
diff
changeset
|
256 (t2-time (/ (cdr t2-date-sec) 60))) |
031aaf217dc3
(calendar-time-zone-daylight-rules): Scan through the
Paul Eggert <eggert@twinsun.com>
parents:
4535
diff
changeset
|
257 (cons |
031aaf217dc3
(calendar-time-zone-daylight-rules): Scan through the
Paul Eggert <eggert@twinsun.com>
parents:
4535
diff
changeset
|
258 (/ (min t0-utc-diff t1-utc-diff) 60) |
031aaf217dc3
(calendar-time-zone-daylight-rules): Scan through the
Paul Eggert <eggert@twinsun.com>
parents:
4535
diff
changeset
|
259 (cons |
031aaf217dc3
(calendar-time-zone-daylight-rules): Scan through the
Paul Eggert <eggert@twinsun.com>
parents:
4535
diff
changeset
|
260 (/ (abs (- t0-utc-diff t1-utc-diff)) 60) |
031aaf217dc3
(calendar-time-zone-daylight-rules): Scan through the
Paul Eggert <eggert@twinsun.com>
parents:
4535
diff
changeset
|
261 (if (< t0-utc-diff t1-utc-diff) |
7749
2f0d34c3059f
(calendar-current-time-zone): Fix typo that
Richard M. Stallman <rms@gnu.org>
parents:
7746
diff
changeset
|
262 (list t0-name t1-name t1-rules t2-rules t1-time t2-time) |
2f0d34c3059f
(calendar-current-time-zone): Fix typo that
Richard M. Stallman <rms@gnu.org>
parents:
7746
diff
changeset
|
263 (list t1-name t0-name t2-rules t1-rules t2-time t1-time) |
4659
031aaf217dc3
(calendar-time-zone-daylight-rules): Scan through the
Paul Eggert <eggert@twinsun.com>
parents:
4535
diff
changeset
|
264 ))))))))))) |
3872 | 265 |
13049
fac816f95bd8
Minor fixes; moved some code here from other calendar files.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
7749
diff
changeset
|
266 ;;; The following eight defvars relating to daylight savings time should NOT be |
3872 | 267 ;;; marked to go into loaddefs.el where they would be evaluated when Emacs is |
268 ;;; dumped. These variables' appropriate values depend on the conditions under | |
269 ;;; which the code is INVOKED; so it's inappropriate to initialize them when | |
270 ;;; Emacs is dumped---they should be initialized when calendar.el is loaded. | |
4659
031aaf217dc3
(calendar-time-zone-daylight-rules): Scan through the
Paul Eggert <eggert@twinsun.com>
parents:
4535
diff
changeset
|
271 ;;; They default to US Eastern time if time zone info is not available. |
3872 | 272 |
273 (calendar-current-time-zone) | |
274 | |
4659
031aaf217dc3
(calendar-time-zone-daylight-rules): Scan through the
Paul Eggert <eggert@twinsun.com>
parents:
4535
diff
changeset
|
275 (defvar calendar-time-zone (or (car calendar-current-time-zone-cache) -300) |
3872 | 276 "*Number of minutes difference between local standard time at |
277 `calendar-location-name' and Coordinated Universal (Greenwich) Time. For | |
278 example, -300 for New York City, -480 for Los Angeles.") | |
279 | |
280 (defvar calendar-daylight-time-offset | |
4659
031aaf217dc3
(calendar-time-zone-daylight-rules): Scan through the
Paul Eggert <eggert@twinsun.com>
parents:
4535
diff
changeset
|
281 (or (car (cdr calendar-current-time-zone-cache)) 60) |
3872 | 282 "*Number of minutes difference between daylight savings and standard time. |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
38422
diff
changeset
|
283 |
3872 | 284 If the locale never uses daylight savings time, set this to 0.") |
285 | |
286 (defvar calendar-standard-time-zone-name | |
4659
031aaf217dc3
(calendar-time-zone-daylight-rules): Scan through the
Paul Eggert <eggert@twinsun.com>
parents:
4535
diff
changeset
|
287 (or (car (nthcdr 2 calendar-current-time-zone-cache)) "EST") |
3872 | 288 "*Abbreviated name of standard time zone at `calendar-location-name'. |
289 For example, \"EST\" in New York City, \"PST\" for Los Angeles.") | |
290 | |
291 (defvar calendar-daylight-time-zone-name | |
4659
031aaf217dc3
(calendar-time-zone-daylight-rules): Scan through the
Paul Eggert <eggert@twinsun.com>
parents:
4535
diff
changeset
|
292 (or (car (nthcdr 3 calendar-current-time-zone-cache)) "EDT") |
3872 | 293 "*Abbreviated name of daylight-savings time zone at `calendar-location-name'. |
294 For example, \"EDT\" in New York City, \"PDT\" for Los Angeles.") | |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
38422
diff
changeset
|
295 |
6735
4930c18bb456
(calendar-daylight-savings-ends)
Richard M. Stallman <rms@gnu.org>
parents:
5001
diff
changeset
|
296 ;;;###autoload |
4930c18bb456
(calendar-daylight-savings-ends)
Richard M. Stallman <rms@gnu.org>
parents:
5001
diff
changeset
|
297 (put 'calendar-daylight-savings-starts 'risky-local-variable t) |
3872 | 298 (defvar calendar-daylight-savings-starts |
4659
031aaf217dc3
(calendar-time-zone-daylight-rules): Scan through the
Paul Eggert <eggert@twinsun.com>
parents:
4535
diff
changeset
|
299 (or (car (nthcdr 4 calendar-current-time-zone-cache)) |
031aaf217dc3
(calendar-time-zone-daylight-rules): Scan through the
Paul Eggert <eggert@twinsun.com>
parents:
4535
diff
changeset
|
300 (and (not (zerop calendar-daylight-time-offset)) |
031aaf217dc3
(calendar-time-zone-daylight-rules): Scan through the
Paul Eggert <eggert@twinsun.com>
parents:
4535
diff
changeset
|
301 '(calendar-nth-named-day 1 0 4 year))) |
3872 | 302 "*Sexp giving the date on which daylight savings time starts. |
303 This is an expression in the variable `year' whose value gives the Gregorian | |
304 date in the form (month day year) on which daylight savings time starts. It is | |
305 used to determine the starting date of daylight savings time for the holiday | |
306 list and for correcting times of day in the solar and lunar calculations. | |
307 | |
308 For example, if daylight savings time is mandated to start on October 1, | |
309 you would set `calendar-daylight-savings-starts' to | |
310 | |
311 '(10 1 year) | |
312 | |
4667
dbe2da5db2f7
(calendar-time-zone-daylight-rules): Remove special case for Israel.
Paul Eggert <eggert@twinsun.com>
parents:
4659
diff
changeset
|
313 If it starts on the first Sunday in April, you would set it to |
3872 | 314 |
4667
dbe2da5db2f7
(calendar-time-zone-daylight-rules): Remove special case for Israel.
Paul Eggert <eggert@twinsun.com>
parents:
4659
diff
changeset
|
315 '(calendar-nth-named-day 1 0 4 year) |
3872 | 316 |
317 If the locale never uses daylight savings time, set this to nil.") | |
318 | |
6735
4930c18bb456
(calendar-daylight-savings-ends)
Richard M. Stallman <rms@gnu.org>
parents:
5001
diff
changeset
|
319 ;;;###autoload |
7746
abd7e801de63
(calendar-daylight-savings-ends): Fix typo in put.
Richard M. Stallman <rms@gnu.org>
parents:
7300
diff
changeset
|
320 (put 'calendar-daylight-savings-ends 'risky-local-variable t) |
3872 | 321 (defvar calendar-daylight-savings-ends |
4659
031aaf217dc3
(calendar-time-zone-daylight-rules): Scan through the
Paul Eggert <eggert@twinsun.com>
parents:
4535
diff
changeset
|
322 (or (car (nthcdr 5 calendar-current-time-zone-cache)) |
031aaf217dc3
(calendar-time-zone-daylight-rules): Scan through the
Paul Eggert <eggert@twinsun.com>
parents:
4535
diff
changeset
|
323 (and (not (zerop calendar-daylight-time-offset)) |
031aaf217dc3
(calendar-time-zone-daylight-rules): Scan through the
Paul Eggert <eggert@twinsun.com>
parents:
4535
diff
changeset
|
324 '(calendar-nth-named-day -1 0 10 year))) |
3872 | 325 "*Sexp giving the date on which daylight savings time ends. |
326 This is an expression in the variable `year' whose value gives the Gregorian | |
327 date in the form (month day year) on which daylight savings time ends. It is | |
328 used to determine the starting date of daylight savings time for the holiday | |
329 list and for correcting times of day in the solar and lunar calculations. | |
330 | |
4667
dbe2da5db2f7
(calendar-time-zone-daylight-rules): Remove special case for Israel.
Paul Eggert <eggert@twinsun.com>
parents:
4659
diff
changeset
|
331 For example, if daylight savings time ends on the last Sunday in October: |
3872 | 332 |
4667
dbe2da5db2f7
(calendar-time-zone-daylight-rules): Remove special case for Israel.
Paul Eggert <eggert@twinsun.com>
parents:
4659
diff
changeset
|
333 '(calendar-nth-named-day -1 0 10 year) |
3872 | 334 |
335 If the locale never uses daylight savings time, set this to nil.") | |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
38422
diff
changeset
|
336 |
4659
031aaf217dc3
(calendar-time-zone-daylight-rules): Scan through the
Paul Eggert <eggert@twinsun.com>
parents:
4535
diff
changeset
|
337 (defvar calendar-daylight-savings-starts-time |
031aaf217dc3
(calendar-time-zone-daylight-rules): Scan through the
Paul Eggert <eggert@twinsun.com>
parents:
4535
diff
changeset
|
338 (or (car (nthcdr 6 calendar-current-time-zone-cache)) 120) |
031aaf217dc3
(calendar-time-zone-daylight-rules): Scan through the
Paul Eggert <eggert@twinsun.com>
parents:
4535
diff
changeset
|
339 "*Number of minutes after midnight that daylight savings time starts.") |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
38422
diff
changeset
|
340 |
4659
031aaf217dc3
(calendar-time-zone-daylight-rules): Scan through the
Paul Eggert <eggert@twinsun.com>
parents:
4535
diff
changeset
|
341 (defvar calendar-daylight-savings-ends-time |
031aaf217dc3
(calendar-time-zone-daylight-rules): Scan through the
Paul Eggert <eggert@twinsun.com>
parents:
4535
diff
changeset
|
342 (or (car (nthcdr 7 calendar-current-time-zone-cache)) |
031aaf217dc3
(calendar-time-zone-daylight-rules): Scan through the
Paul Eggert <eggert@twinsun.com>
parents:
4535
diff
changeset
|
343 calendar-daylight-savings-starts-time) |
031aaf217dc3
(calendar-time-zone-daylight-rules): Scan through the
Paul Eggert <eggert@twinsun.com>
parents:
4535
diff
changeset
|
344 "*Number of minutes after midnight that daylight savings time ends.") |
3872 | 345 |
13049
fac816f95bd8
Minor fixes; moved some code here from other calendar files.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
7749
diff
changeset
|
346 (defun dst-in-effect (date) |
fac816f95bd8
Minor fixes; moved some code here from other calendar files.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
7749
diff
changeset
|
347 "True if on absolute DATE daylight savings time is in effect. |
13686
6e3b9c9595eb
Fixed dst-in-effect for southern hemisphere. Also made doc string clearer.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
13049
diff
changeset
|
348 Fractional part of DATE is local standard time of day." |
13049
fac816f95bd8
Minor fixes; moved some code here from other calendar files.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
7749
diff
changeset
|
349 (let* ((year (extract-calendar-year |
fac816f95bd8
Minor fixes; moved some code here from other calendar files.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
7749
diff
changeset
|
350 (calendar-gregorian-from-absolute (floor date)))) |
13686
6e3b9c9595eb
Fixed dst-in-effect for southern hemisphere. Also made doc string clearer.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
13049
diff
changeset
|
351 (dst-starts-gregorian (eval calendar-daylight-savings-starts)) |
6e3b9c9595eb
Fixed dst-in-effect for southern hemisphere. Also made doc string clearer.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
13049
diff
changeset
|
352 (dst-ends-gregorian (eval calendar-daylight-savings-ends)) |
6e3b9c9595eb
Fixed dst-in-effect for southern hemisphere. Also made doc string clearer.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
13049
diff
changeset
|
353 (dst-starts (and dst-starts-gregorian |
13049
fac816f95bd8
Minor fixes; moved some code here from other calendar files.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
7749
diff
changeset
|
354 (+ (calendar-absolute-from-gregorian |
13686
6e3b9c9595eb
Fixed dst-in-effect for southern hemisphere. Also made doc string clearer.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
13049
diff
changeset
|
355 dst-starts-gregorian) |
13049
fac816f95bd8
Minor fixes; moved some code here from other calendar files.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
7749
diff
changeset
|
356 (/ calendar-daylight-savings-starts-time |
fac816f95bd8
Minor fixes; moved some code here from other calendar files.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
7749
diff
changeset
|
357 60.0 24.0)))) |
13686
6e3b9c9595eb
Fixed dst-in-effect for southern hemisphere. Also made doc string clearer.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
13049
diff
changeset
|
358 (dst-ends (and dst-ends-gregorian |
13049
fac816f95bd8
Minor fixes; moved some code here from other calendar files.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
7749
diff
changeset
|
359 (+ (calendar-absolute-from-gregorian |
13686
6e3b9c9595eb
Fixed dst-in-effect for southern hemisphere. Also made doc string clearer.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
13049
diff
changeset
|
360 dst-ends-gregorian) |
13049
fac816f95bd8
Minor fixes; moved some code here from other calendar files.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
7749
diff
changeset
|
361 (/ (- calendar-daylight-savings-ends-time |
fac816f95bd8
Minor fixes; moved some code here from other calendar files.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
7749
diff
changeset
|
362 calendar-daylight-time-offset) |
fac816f95bd8
Minor fixes; moved some code here from other calendar files.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
7749
diff
changeset
|
363 60.0 24.0))))) |
13686
6e3b9c9595eb
Fixed dst-in-effect for southern hemisphere. Also made doc string clearer.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
13049
diff
changeset
|
364 (and dst-starts dst-ends |
6e3b9c9595eb
Fixed dst-in-effect for southern hemisphere. Also made doc string clearer.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
13049
diff
changeset
|
365 (if (< dst-starts dst-ends) |
6e3b9c9595eb
Fixed dst-in-effect for southern hemisphere. Also made doc string clearer.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
13049
diff
changeset
|
366 (and (<= dst-starts date) (< date dst-ends)) |
6e3b9c9595eb
Fixed dst-in-effect for southern hemisphere. Also made doc string clearer.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
13049
diff
changeset
|
367 (or (<= dst-starts date) (< date dst-ends)))))) |
13049
fac816f95bd8
Minor fixes; moved some code here from other calendar files.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
7749
diff
changeset
|
368 |
fac816f95bd8
Minor fixes; moved some code here from other calendar files.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
7749
diff
changeset
|
369 (defun dst-adjust-time (date time &optional style) |
fac816f95bd8
Minor fixes; moved some code here from other calendar files.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
7749
diff
changeset
|
370 "Adjust, to account for dst on DATE, decimal fraction standard TIME. |
fac816f95bd8
Minor fixes; moved some code here from other calendar files.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
7749
diff
changeset
|
371 Returns a list (date adj-time zone) where `date' and `adj-time' are the values |
fac816f95bd8
Minor fixes; moved some code here from other calendar files.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
7749
diff
changeset
|
372 adjusted for `zone'; here `date' is a list (month day year), `adj-time' is a |
fac816f95bd8
Minor fixes; moved some code here from other calendar files.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
7749
diff
changeset
|
373 decimal fraction time, and `zone' is a string. |
fac816f95bd8
Minor fixes; moved some code here from other calendar files.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
7749
diff
changeset
|
374 |
fac816f95bd8
Minor fixes; moved some code here from other calendar files.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
7749
diff
changeset
|
375 Optional parameter STYLE forces the result time to be standard time when its |
fac816f95bd8
Minor fixes; moved some code here from other calendar files.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
7749
diff
changeset
|
376 value is 'standard and daylight savings time (if available) when its value is |
fac816f95bd8
Minor fixes; moved some code here from other calendar files.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
7749
diff
changeset
|
377 'daylight. |
fac816f95bd8
Minor fixes; moved some code here from other calendar files.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
7749
diff
changeset
|
378 |
fac816f95bd8
Minor fixes; moved some code here from other calendar files.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
7749
diff
changeset
|
379 Conversion to daylight savings time is done according to |
fac816f95bd8
Minor fixes; moved some code here from other calendar files.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
7749
diff
changeset
|
380 `calendar-daylight-savings-starts', `calendar-daylight-savings-ends', |
fac816f95bd8
Minor fixes; moved some code here from other calendar files.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
7749
diff
changeset
|
381 `calendar-daylight-savings-starts-time', |
fac816f95bd8
Minor fixes; moved some code here from other calendar files.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
7749
diff
changeset
|
382 `calendar-daylight-savings-ends-time', and |
fac816f95bd8
Minor fixes; moved some code here from other calendar files.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
7749
diff
changeset
|
383 `calendar-daylight-savings-offset'." |
fac816f95bd8
Minor fixes; moved some code here from other calendar files.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
7749
diff
changeset
|
384 |
fac816f95bd8
Minor fixes; moved some code here from other calendar files.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
7749
diff
changeset
|
385 (let* ((rounded-abs-date (+ (calendar-absolute-from-gregorian date) |
fac816f95bd8
Minor fixes; moved some code here from other calendar files.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
7749
diff
changeset
|
386 (/ (round (* 60 time)) 60.0 24.0))) |
fac816f95bd8
Minor fixes; moved some code here from other calendar files.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
7749
diff
changeset
|
387 (dst (dst-in-effect rounded-abs-date)) |
fac816f95bd8
Minor fixes; moved some code here from other calendar files.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
7749
diff
changeset
|
388 (time-zone (if dst |
fac816f95bd8
Minor fixes; moved some code here from other calendar files.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
7749
diff
changeset
|
389 calendar-daylight-time-zone-name |
fac816f95bd8
Minor fixes; moved some code here from other calendar files.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
7749
diff
changeset
|
390 calendar-standard-time-zone-name)) |
fac816f95bd8
Minor fixes; moved some code here from other calendar files.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
7749
diff
changeset
|
391 (time (+ rounded-abs-date |
fac816f95bd8
Minor fixes; moved some code here from other calendar files.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
7749
diff
changeset
|
392 (if dst (/ calendar-daylight-time-offset 24.0 60.0) 0)))) |
fac816f95bd8
Minor fixes; moved some code here from other calendar files.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
7749
diff
changeset
|
393 (list (calendar-gregorian-from-absolute (truncate time)) |
fac816f95bd8
Minor fixes; moved some code here from other calendar files.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
7749
diff
changeset
|
394 (* 24.0 (- time (truncate time))) |
fac816f95bd8
Minor fixes; moved some code here from other calendar files.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
7749
diff
changeset
|
395 time-zone))) |
fac816f95bd8
Minor fixes; moved some code here from other calendar files.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
7749
diff
changeset
|
396 |
3872 | 397 (provide 'cal-dst) |
398 | |
52401 | 399 ;;; arch-tag: a141d204-213c-4ca5-bdc6-f9df3aa92aad |
3872 | 400 ;;; cal-dst.el ends here |