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

Bug in time<=? and time>=?



Hi,

I think there is a bug in the implementation of the aforementioned procedures. The same bug is present in time<=? and time>=?. I'll use the PLT implementation of  time<=? as an example:

  (define (time<=? time1 time2)
    (tm:time-compare-check time1 time2 'time<=?)
    (or (<= (time-second time1) (time-second time2))
        (and (= (time-second time1) (time-second time2))
             (<= (time-nanosecond time1) (time-nanosecond time2)))))

The first <= should be a <, like this:

  (define (time<=? time1 time2)
    (tm:time-compare-check time1 time2 'time<=?)
    (or (< (time-second time1) (time-second time2))
        (and (= (time-second time1) (time-second time2))
             (<= (time-nanosecond time1) (time-nanosecond time2)))))

Otherwise the following code erroneously returns #t:

  (time<=? (make-time time-utc 2 1)
           (make-time time-utc 1 1))

I've filed a bug report for this in PLT. I'm not sure if the bug is also present in the reference implementation.

Many thanks,

-- Dave Gurnell