[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Flaky execution

REGARDING                Flaky execution
What's wrong with this code, if anything, or is it something about

(defun julian-date-to-universal-time (julian-date)
  (let* ((year (read-from-string (subseq julian-date 0 2)))
            (days (read-from-string (subseq julian-date 2))))
    (encode-universal-time 0 0 0 days 1 (if (> year 80)
                                          (+ year 1900)
                                          (+ year 2000)) 0)))

This function takes a Julian date as a string YYDDD and converts it to
universal time.  If I evaluate (julian-date-to-universal-time "90100")
many times in a loop, I get two different answers.  Most of the time,
the result is 2848694400, which corresponds to the right day, April 9,

Sometimes, however, the result is 18446743950740665216, which back
translates to April 9 in some year WAY out in the future.  Binding the
final result and returning it using a VALUES form seems to help on the
840AV, but not on the Quadra 650.

Byron Davies
(602) 706-1462