From: Brian Mastenbrook Date: Thu, 21 Jul 2005 02:36:23 +0000 (+0000) Subject: 0.9.2.52: fix some bugs relating to universal times outside Unix's representable... X-Git-Url: http://repo.macrolet.net/gitweb/?a=commitdiff_plain;h=3e74cbbce991eb6c5b9b10ca9b2617b48fad54ec;p=sbcl.git 0.9.2.52: fix some bugs relating to universal times outside Unix's representable range in DECODE- and ENCODE-UNIVERSAL-TIME (reported by Paul Dietz and his magical ANSI test suite) --- diff --git a/NEWS b/NEWS index 356018a..536dd66 100644 --- a/NEWS +++ b/NEWS @@ -34,6 +34,7 @@ changes in sbcl-0.9.3 relative to sbcl-0.9.2: an inappropriate moment ** bug fix: run-program is now thread safe(r) ** bug fix: inner with-recursive-lock no longer releases the mutex + * fixed a bug in (DECODE-UNIVERSAL-TIME 0) (reported by Paul Dietz) * fixed some bugs revealed by Paul Dietz' test suite: ** TYPE-ERRORs from signalled by COERCE now have DATUM and EXPECTED-TYPE slots filled. @@ -41,6 +42,8 @@ changes in sbcl-0.9.3 relative to sbcl-0.9.2: values form. ** MAKE-CONDITION accepts classes as type-designators. ** COMPILE may never return NIL. + ** ENCODE-UNIVERSAL-TIME now guards against times out of Unix's + range before calling Unix time functions changes in sbcl-0.9.2 relative to sbcl-0.9.1: * numerous signal handling fixes to increase stability diff --git a/src/code/time.lisp b/src/code/time.lisp index 52c3059..dd8d3a5 100644 --- a/src/code/time.lisp +++ b/src/code/time.lisp @@ -159,7 +159,8 @@ (defun truncate-to-unix-range (utime) (let ((unix-time (- utime unix-to-universal-time))) - (if (< unix-time (ash 1 31)) + (if (and (>= unix-time 0) + (< unix-time (ash 1 31))) unix-time (multiple-value-bind (year offset) (years-since-mar-2000 utime) (declare (ignore year)) @@ -277,12 +278,12 @@ (leap-years-before fake-year))))))) (let* ((secwest-guess (sb!unix::unix-get-seconds-west - (- (* hours 60 60) unix-to-universal-time))) + (truncate-to-unix-range (* hours 60 60)))) (guess (+ second (* 60 (+ minute (* hours 60))) secwest-guess)) (secwest (sb!unix::unix-get-seconds-west - (- guess unix-to-universal-time)))) + (truncate-to-unix-range guess)))) (+ guess (- secwest secwest-guess))))))) ;;;; TIME diff --git a/version.lisp-expr b/version.lisp-expr index 4de0235..4c53cf1 100644 --- a/version.lisp-expr +++ b/version.lisp-expr @@ -17,4 +17,4 @@ ;;; checkins which aren't released. (And occasionally for internal ;;; versions, especially for internal versions off the main CVS ;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".) -"0.9.2.51" +"0.9.2.52"