Mercurial > emacs
comparison lisp/calendar/cal-dst.el @ 88155:d7ddb3e565de
sync with trunk
author | Henrik Enberg <henrik.enberg@telia.com> |
---|---|
date | Mon, 16 Jan 2006 00:03:54 +0000 |
parents | 0d8b17d428b5 |
children |
comparison
equal
deleted
inserted
replaced
88154:8ce476d3ba36 | 88155:d7ddb3e565de |
---|---|
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, 1996 Free Software Foundation, Inc. | 3 ;; Copyright (C) 1993, 1994, 1995, 1996, 2001, 2002, 2003, 2004, 2005 |
4 ;; Free Software Foundation, Inc. | |
4 | 5 |
5 ;; Author: Paul Eggert <eggert@twinsun.com> | 6 ;; Author: Paul Eggert <eggert@twinsun.com> |
6 ;; Edward M. Reingold <reingold@cs.uiuc.edu> | 7 ;; Edward M. Reingold <reingold@cs.uiuc.edu> |
8 ;; Maintainer: Glenn Morris <rgm@gnu.org> | |
7 ;; Keywords: calendar | 9 ;; Keywords: calendar |
8 ;; Human-Keywords: daylight savings time, calendar, diary, holidays | 10 ;; Human-Keywords: daylight savings time, calendar, diary, holidays |
9 | 11 |
10 ;; This file is part of GNU Emacs. | 12 ;; This file is part of GNU Emacs. |
11 | 13 |
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 21 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
20 ;; GNU General Public License for more details. | 22 ;; GNU General Public License for more details. |
21 | 23 |
22 ;; You should have received a copy of the GNU General Public License | 24 ;; You should have received a copy of the GNU General Public License |
23 ;; along with GNU Emacs; see the file COPYING. If not, write to the | 25 ;; along with GNU Emacs; see the file COPYING. If not, write to the |
24 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 26 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
25 ;; Boston, MA 02111-1307, USA. | 27 ;; Boston, MA 02110-1301, USA. |
26 | 28 |
27 ;;; Commentary: | 29 ;;; Commentary: |
28 | 30 |
29 ;; This collection of functions implements the features of calendar.el and | 31 ;; This collection of functions implements the features of calendar.el and |
30 ;; holiday.el that deal with daylight savings time. | 32 ;; holiday.el that deal with daylight savings time. |
68 (+ (* (mod u 675) 128) (mod l 128))))) | 70 (+ (* (mod u 675) 128) (mod l 128))))) |
69 | 71 |
70 (defun calendar-time-from-absolute (abs-date s) | 72 (defun calendar-time-from-absolute (abs-date s) |
71 "Time of absolute date ABS-DATE, S seconds after midnight. | 73 "Time of absolute date ABS-DATE, S seconds after midnight. |
72 | 74 |
73 Returns the pair (HIGH . LOW) where HIGH and LOW are the high and low | 75 Returns the list (HIGH LOW) where HIGH and LOW are the high and low |
74 16 bits, respectively, of the number of seconds 1970-01-01 00:00:00 UTC, | 76 16 bits, respectively, of the number of seconds 1970-01-01 00:00:00 UTC, |
75 ignoring leap seconds, that is the equivalent moment to S seconds after | 77 ignoring leap seconds, that is the equivalent moment to S seconds after |
76 midnight UTC on absolute date ABS-DATE." | 78 midnight UTC on absolute date ABS-DATE." |
77 (let* ((a (- abs-date calendar-system-time-basis)) | 79 (let* ((a (- abs-date calendar-system-time-basis)) |
78 (u (+ (* 163 (mod a 512)) (floor s 128)))) | 80 (u (+ (* 163 (mod a 512)) (floor s 128)))) |
79 ;; Overflow is a terrible thing! | 81 ;; Overflow is a terrible thing! |
80 (cons | 82 (list |
81 ;; floor((60*60*24*a + s) / 2^16) | 83 ;; floor((60*60*24*a + s) / 2^16) |
82 (+ a (* 163 (floor a 512)) (floor u 512)) | 84 (+ a (* 163 (floor a 512)) (floor u 512)) |
83 ;; (60*60*24*a + s) mod 2^16 | 85 ;; (60*60*24*a + s) mod 2^16 |
84 (+ (* 128 (mod u 512)) (mod s 128))))) | 86 (+ (* 128 (mod u 512)) (mod s 128))))) |
85 | 87 |
392 (* 24.0 (- time (truncate time))) | 394 (* 24.0 (- time (truncate time))) |
393 time-zone))) | 395 time-zone))) |
394 | 396 |
395 (provide 'cal-dst) | 397 (provide 'cal-dst) |
396 | 398 |
399 ;;; arch-tag: a141d204-213c-4ca5-bdc6-f9df3aa92aad | |
397 ;;; cal-dst.el ends here | 400 ;;; cal-dst.el ends here |