Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
emacs
emacs
Commits
8bab5c18
Commit
8bab5c18
authored
Aug 10, 1993
by
Roland McGrath
Browse files
(calendar-absolute-from-time, calendar-time-from-absolute): Use % in place
of mod. Use (floor (/ A B)) in place of (floor A B).
parent
551dd6e3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
6 deletions
+6
-6
lisp/calendar/cal-dst.el
lisp/calendar/cal-dst.el
+6
-6
No files found.
lisp/calendar/cal-dst.el
View file @
8bab5c18
...
...
@@ -58,13 +58,13 @@ absolute date ABS-DATE is the equivalent moment to X."
(
let*
((
h
(
car
x
))
(
xtail
(
cdr
x
))
(
l
(
+
utc-diff
(
if
(
numberp
xtail
)
xtail
(
car
xtail
))))
(
u
(
+
(
*
512
(
mod
h
675
))
(
floor
l
128
))))
(
u
(
+
(
*
512
(
%
h
675
))
(
floor
(
/
l
128
))))
)
;; Overflow is a terrible thing!
(
cons
(
+
calendar-system-time-basis
;; floor((2^16 h +l) / (60*60*24))
(
*
512
(
mod
h
675
))
(
floor
u
675
))
(
*
512
(
%
h
675
))
(
floor
(
/
u
675
))
)
;; (2^16 h +l) % (60*60*24)
(
+
(
*
(
mod
u
675
)
128
)
(
floor
l
128
)))))
(
+
(
*
(
%
u
675
)
128
)
(
floor
(
%
l
128
)))))
)
(
defun
calendar-time-from-absolute
(
abs-date
s
)
"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
ignoring leap seconds, that is the equivalent moment to S seconds after
midnight UTC on absolute date ABS-DATE."
(
let*
((
a
(
-
abs-date
calendar-system-time-basis
))
(
u
(
+
(
*
163
(
mod
a
512
))
(
floor
s
128
))))
(
u
(
+
(
*
163
(
%
a
512
))
(
floor
(
/
s
128
))))
)
;; Overflow is a terrible thing!
(
cons
;; (60*60*24*a + s) / 2^16
(
+
a
(
*
163
(
floor
a
512
))
(
floor
u
512
))
(
+
a
(
*
163
(
floor
(
/
a
512
))
)
(
floor
(
/
u
512
))
)
;; (60*60*24*a + s) % 2^16
(
+
(
*
128
(
mod
u
512
))
(
mod
s
128
)))))
(
+
(
*
128
(
%
u
512
))
(
%
s
128
)))))
(
defun
calendar-next-time-zone-transition
(
time
)
"Return the time of the next time zone transition after TIME.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment