[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-users] Date/time problem (my code I am sure)
From: |
Jeremy Cowgar |
Subject: |
Re: [Chicken-users] Date/time problem (my code I am sure) |
Date: |
Thu, 21 Dec 2006 11:04:51 -0500 |
User-agent: |
Mutt/1.5.13 (2006-08-11) |
Quoting Kon Lovett <address@hidden>:
>
> Hi Jeremy,
>
> What version of the srfi-19 egg are you using?
Version: 2.3 (Release 200612190544)
> With a slight
> modification to your example above & srfi-19 2.3:
>
> ... <same> ...
>
> (define (distance-of-time-in-words from #!optional (to (current-date)))
> (let* ((from-time (to-time from))
> (to-time (to-time to))
> (diff (time-difference from-time to-time))
> (distance-in-seconds (time-second diff)))
> (list from-time to-time diff distance-in-seconds)))
>
> (define vec1 (vector 2006 12 20))
> (define vec2 (vector 2006 12 19))
> (print (distance-of-time-in-words vec1))
> => (#,(time time-utc 0 1166572800) #,(time time-utc 447000027
> 1166713173) #,(time time-duration 447000027 -140373) -140373)
> (print (distance-of-time-in-words vec1 vec2))
> => (#,(time time-utc 0 1166572800) #,(time time-utc 0 1166486400) #,
> (time time-duration 0 86400) 86400)
>
> -140373 is a sensible result.
I must be missing something. Was the only change you made making the interm
var diff and then returning a list? I did the same over here and am not
seeing the same results as you, I still have the old results, 7,000 some odd
days.
Jeremy