70 |
(defun calendar-time-from-absolute (abs-date s) |
(defun calendar-time-from-absolute (abs-date s) |
71 |
"Time of absolute date ABS-DATE, S seconds after midnight. |
"Time of absolute date ABS-DATE, S seconds after midnight. |
72 |
|
|
73 |
Returns the pair (HIGH . LOW) where HIGH and LOW are the high and low |
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, |
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 |
ignoring leap seconds, that is the equivalent moment to S seconds after |
76 |
midnight UTC on absolute date ABS-DATE." |
midnight UTC on absolute date ABS-DATE." |
77 |
(let* ((a (- abs-date calendar-system-time-basis)) |
(let* ((a (- abs-date calendar-system-time-basis)) |
78 |
(u (+ (* 163 (mod a 512)) (floor s 128)))) |
(u (+ (* 163 (mod a 512)) (floor s 128)))) |
79 |
;; Overflow is a terrible thing! |
;; Overflow is a terrible thing! |
80 |
(cons |
(list |
81 |
;; floor((60*60*24*a + s) / 2^16) |
;; floor((60*60*24*a + s) / 2^16) |
82 |
(+ a (* 163 (floor a 512)) (floor u 512)) |
(+ a (* 163 (floor a 512)) (floor u 512)) |
83 |
;; (60*60*24*a + s) mod 2^16 |
;; (60*60*24*a + s) mod 2^16 |