[Openmcl-devel] Universal time question
Phil
pbpublist at comcast.net
Thu Apr 27 13:45:05 PDT 2006
Gary,
Thanks for the info and I see the problem in my math. While truncating
the time, I forgot to factor in the time zone: I needed to truncate the
h:m:s and then add back the local time zone delta to get back to midnight.
Thanks,
Phil
Gary Byers wrote:
> Note that GET-UNIVERSAL-TIME returns the number of seconds since
> January 1,1900 GMT, and that DECODE-UNIVERSAL-TIME decodes a universal
> time relative to the local time zone (unless DECODE-UNIVERSAL-TIME
> is given an explicit time zone as a second argument.)
>
> So (as of a few minutes ago ...):
>
> ? (setf mytime1 (get-universal-time))
> 3355113528
> ? (setf mytime2 (* (floor (/ mytime1 86400)) 86400))
> 3355084800
> ? (decode-universal-time mytime2 0)
> 0
> 0
> 0
> 27
> 4
> 2006
> 3 ; Hmm. Is it Wednesday or Thursday ?
> NIL
> 0
>
> You were getting the same answer, but DECODE-UNIVERSAL-TIME was presenting
> it in your local time zone (and doing DST handling).
>
> Aside from the question of what day of the week it is at midnight, I'm
> aware of a couple of bugs in 1.0 related to universal time functions:
>
> - ENCODE-UNIVERSAL-TIME doesn't handle 2-digit years correctly (so 05
> is "2001 years ago", rather than "last year")
>
> - functions that accept a timezone argument probably don't accept the
> full range of legal values (I've seen some test suite failures, but
> don't remember the exact details.)
>
More information about the Openmcl-devel
mailing list