Hi,
I got the weird timezone value of -331/45 by evaluating
(DECODE-UNIVERSAL-TIME 3742); timezone value of -15/2 with
(DECODE-UNIVERSAL-TIME 900000000).
Is this an expected behaviour? I'll expect it to return -8 (which is my
time-zone) for every positive integer. For reference, (GET-DECODED-TIME)
works perfectly fine (i.e. returning correct date, time, and timezone):
CL-USER> (get-decoded-time)
39
28
11
25
4
2023
1
NIL
-8
After debugging it a little bit, DECODE-UNIVERSAL-TIME seems to return:
-331/45 for every integer in the range [0,825525519] (inclusive),
-15/2 for [825525520, 1041352199], and
-8 for [1041352200, positive infinity?).
My debugging code:
(defun ut-time-zone (int)
(multiple-value-bind (s m h d month y day daylight zone)
(decode-universal-time int)
(declare (ignore s m h d month y day daylight))
zone))
(defun half-int (a b)
(truncate (/ (+ a b) 2)))
(defun time-zone-not-x (lower upper timezone)
(loop for x = (half-int lower upper)
if (= (ut-time-zone x) timezone)
do (setf upper x)
else
do (setf lower x)
until (and (/= (ut-time-zone x) timezone)
(= (ut-time-zone (1+ x)) timezone))
finally (return x)))
At the REPL:
CL-USER> (time-zone-not-x 3742 900000000 -15/2)
825525519
CL-USER> (time-zone-not-x 900000000 1500000000 -8)
1041352199
My machine and environment: x86_64, Xubuntu 20.04.3 LTS (Linux 5.15
kernel), SBCL 2.2.10.
From:
Jiahong
_______________________________________________
Sbcl-help mailing list
Sbcl...@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sbcl-help