[squeak-dev] Bug in DateAndTime fromUnixTime: ???

Nicola Mingotti nmingotti at gmail.com
Sat Sep 28 09:29:23 UTC 2019


Hi,

I agree, there must be something wrong, the following example gets the 
time, converts it to Unix Epoch and then reads the Unix Epoch back in 
local time. It fails.

AFAICsay, the Unix epoch is correct.

----

DateAndTime now.
" 2019-09-28T*02:10*:32.361354*-07:00*"

(DateAndTime now) asUnixTime.
" 1569662550"

DateAndTime fromUnixTime: 1569662550.
"2019-09-28T*09:22*:30*-07:00*"

----

bye
nicola




On 9/27/19 10:28 PM, John-Reed Maffeo wrote:
> When I execute :
> DateAndTime fromUnixTime: 1569648600
> The value I get is :    2019-09-28T05:30:00-07:00
>
> This looks wrong to me because UNIX time is supposed to be in UTC and 
> the value shows an offset of -07:00 hours which I assume is the offset 
> for Mountain Standard Time in the US.
>
> My understanding is that the UTC value should be 2019-09-28T05:30:00-00:00
> and I would have to convert it to 2019-09-27T10:30:00-07:00 to get the 
> local time.
>
> If the method #fromUnixTime is expected to return a value with the 
> local timezone offset, then the time value should be adjusted to local 
> time to match the offset.
>
> However, I don't think that a UNIX time value should be represented in 
> anything but UTC and the application should decide when and how to 
> modify it.
>
> - jrm
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20190928/33f3c19c/attachment.html>


More information about the Squeak-dev mailing list