Hi.

Evaluating:

DateAndTime now asUnixTime 

and then creating a DateAndTime object from the result:

DateAndTime fromUnixTime: <seconds>

does not yield an equivalent object. As far as I can tell, this is because the 
unix epoch is hard coded in two places:

DateAndTime class>>unixEpoch
        "Answer a DateAndTime representing the Unix epoch (1 January 1970, 
midnight UTC)"
        ^ self basicNew
                ticks: #(2440588 0 0) offset: Duration zero;
                yourself.

DateAndTime>>fromUnixTime: anInteger
        ^ self fromSeconds: anInteger + 
                2177452800 "unix epoch constant"

So in the end I get a difference of 7200 seconds.

I'll gladly open up a bug but can someone please confirm that this is actually 
a bug and that I didn't miss something?

Cheers,
Max
_______________________________________________
Pharo-project mailing list
[email protected]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project

Reply via email to