[Openmcl-devel] Universal time question

Gary Byers gb at clozure.com
Thu Apr 27 01:11:54 PDT 2006


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.)


On Thu, 27 Apr 2006, Phil wrote:

> When attempting to perform some date math, I ran into a problem and am
> trying to determine if my logic is at fault, I'm not understanding
> universal time handling, or have hit an OpenMCL bug.
>
> The example case: given a universal time, drop the time portion of the
> universal time and compare the decode output of the before and after values:
>
> (setf mytime1 (get-universal-time))
> (decode-universal-time mytime1) ; returned: 34 56 2 27 4 2006 3 T 5
> (setf mytime2 (* (floor (/ mytime1 86400)) 86400))
> (decode-universal-time mytime2) ; returned: 0 0 20 26 4 2006 2 T 5
> expected: 0 0 0 27 4 2006 3 T 5
>
> Any insight as to what is going on is appreciated.
>
> Phil
>
> _______________________________________________
> Openmcl-devel mailing list
> Openmcl-devel at clozure.com
> http://clozure.com/mailman/listinfo/openmcl-devel
>
>



More information about the Openmcl-devel mailing list