[local-time-devel] Endless loop (or something similar) in adjust-timestamp

Mihai Călin Bazon mihai.bazon at gmail.com
Sun Dec 19 17:49:14 UTC 2010


Hi folks,

By accident, I found that the following never returns (well, at least
here; my timezone is GMT+3, running SBCL 1.0.44.36):

(local-time:adjust-timestamp (local-time:encode-timestamp 0 0 0 3 11 4
2010 :offset (* 3 3600)) (offset :day -14))

This seems to fix it and looks correct, though I can't be sure about it:

diff -rN -u old-local-time/src/local-time.lisp
new-local-time/src/local-time.lisp
--- old-local-time/src/local-time.lisp    2010-12-19 19:46:52.972488057 +0200
+++ new-local-time/src/local-time.lisp    2010-12-19 19:46:53.134995442 +0200
@@ -545,7 +545,7 @@
 (defun transition-position (needle haystack &optional (start 0) (end
(1- (length haystack))))
   (let ((middle (floor (+ end start) 2)))
     (cond
-      ((> start end)
+      ((>= start end)
        (if (minusp end)
            0
            end))

Other ideas?

Cheers,
--
Mihai Bazon,
http://mihai.bazon.net/blog




More information about the local-time-devel mailing list