diff options
| -rw-r--r-- | lisp/calendar/cal-dst.el | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/lisp/calendar/cal-dst.el b/lisp/calendar/cal-dst.el index 62ca6b089a1..4726ba1fd23 100644 --- a/lisp/calendar/cal-dst.el +++ b/lisp/calendar/cal-dst.el | |||
| @@ -58,13 +58,13 @@ absolute date ABS-DATE is the equivalent moment to X." | |||
| 58 | (let* ((h (car x)) | 58 | (let* ((h (car x)) |
| 59 | (xtail (cdr x)) | 59 | (xtail (cdr x)) |
| 60 | (l (+ utc-diff (if (numberp xtail) xtail (car xtail)))) | 60 | (l (+ utc-diff (if (numberp xtail) xtail (car xtail)))) |
| 61 | (u (+ (* 512 (mod h 675)) (floor l 128)))) | 61 | (u (+ (* 512 (% h 675)) (floor (/ l 128))))) |
| 62 | ;; Overflow is a terrible thing! | 62 | ;; Overflow is a terrible thing! |
| 63 | (cons (+ calendar-system-time-basis | 63 | (cons (+ calendar-system-time-basis |
| 64 | ;; floor((2^16 h +l) / (60*60*24)) | 64 | ;; floor((2^16 h +l) / (60*60*24)) |
| 65 | (* 512 (mod h 675)) (floor u 675)) | 65 | (* 512 (% h 675)) (floor (/ u 675))) |
| 66 | ;; (2^16 h +l) % (60*60*24) | 66 | ;; (2^16 h +l) % (60*60*24) |
| 67 | (+ (* (mod u 675) 128) (floor l 128))))) | 67 | (+ (* (% u 675) 128) (floor (% l 128)))))) |
| 68 | 68 | ||
| 69 | (defun calendar-time-from-absolute (abs-date s) | 69 | (defun calendar-time-from-absolute (abs-date s) |
| 70 | "Time of absolute date ABS-DATE, S seconds after midnight. | 70 | "Time of absolute date ABS-DATE, S seconds after midnight. |
| @@ -74,13 +74,13 @@ Returns the pair (HIGH . LOW) where HIGH and LOW are the high and low | |||
| 74 | ignoring leap seconds, that is the equivalent moment to S seconds after | 74 | ignoring leap seconds, that is the equivalent moment to S seconds after |
| 75 | midnight UTC on absolute date ABS-DATE." | 75 | midnight UTC on absolute date ABS-DATE." |
| 76 | (let* ((a (- abs-date calendar-system-time-basis)) | 76 | (let* ((a (- abs-date calendar-system-time-basis)) |
| 77 | (u (+ (* 163 (mod a 512)) (floor s 128)))) | 77 | (u (+ (* 163 (% a 512)) (floor (/ s 128))))) |
| 78 | ;; Overflow is a terrible thing! | 78 | ;; Overflow is a terrible thing! |
| 79 | (cons | 79 | (cons |
| 80 | ;; (60*60*24*a + s) / 2^16 | 80 | ;; (60*60*24*a + s) / 2^16 |
| 81 | (+ a (* 163 (floor a 512)) (floor u 512)) | 81 | (+ a (* 163 (floor (/ a 512))) (floor (/ u 512))) |
| 82 | ;; (60*60*24*a + s) % 2^16 | 82 | ;; (60*60*24*a + s) % 2^16 |
| 83 | (+ (* 128 (mod u 512)) (mod s 128))))) | 83 | (+ (* 128 (% u 512)) (% s 128))))) |
| 84 | 84 | ||
| 85 | (defun calendar-next-time-zone-transition (time) | 85 | (defun calendar-next-time-zone-transition (time) |
| 86 | "Return the time of the next time zone transition after TIME. | 86 | "Return the time of the next time zone transition after TIME. |