[squeak-dev] DateAndTimeLeapTest>>testAsSeconds is broken

Bert Freudenberg bert at freudenbergs.de
Thu Dec 1 15:53:24 UTC 2016


On Thu, Dec 1, 2016 at 4:17 PM, Bert Freudenberg <bert at freudenbergs.de>
wrote:

> On Thu, Dec 1, 2016 at 2:29 PM, David T. Lewis <lewis at mail.msen.com>
> wrote:
>
>> On Thu, Dec 01, 2016 at 11:07:45AM +0100, Bert Freudenberg wrote:
>>
> Here I am raising a different (but admittedly related) question. How many
>> seconds
>> elapsed between the Smalltalk epoch and the time
>> 2004-02-29T13:33:00+02:00?
>>
>
> => 3255507180 <(325)%20550-7180> + DateAndTime localOffset asSeconds
>
> My reasoning:
>
> ('1901-01-01T00:00:00+02:00' asDateAndTime - DateAndTime epoch) asSeconds
>  = (0 + DateAndTime localOffset asSeconds - 7200)
>
> and so
>
> ('2004-02-29T13:33:00+02:00' asDateAndTime - DateAndTime epoch) asSeconds
> = (3255514380 <(325)%20551-4380> + DateAndTime localOffset asSeconds -
> 7200)
>
> It can't be a constant but needs to take into account the local time zone.
> Because Smalltalk epoch is defined as local time, the difference to a fixed
> time necessarily involves the timezone offset.
>

Ah, but #asSeconds uses the epoch in the time zone of that DateAndTime
instance, so it *is* a constant after all ... But it's not constant wrt
your own local time zone.

Then again, maybe fromSeconds: and asSeconds should be symmetric. They're
not, because asSeconds uses the instance's time zone, but fromSeconds: uses
local time zone.

It's also quit possible I'm totally confused - I did not use independent
resources but was just relying on Squeak.

- Bert -
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20161201/e37b960c/attachment.html>


More information about the Squeak-dev mailing list