[squeak-dev] DateAndTimeLeapTest>>testAsSeconds is broken

Levente Uzonyi leves at caesar.elte.hu
Sat Dec 3 21:19:25 UTC 2016

On Sat, 3 Dec 2016, Chris Muller wrote:

> One issue appears to be that the #epoch is calculated relative to
> "self localOffset".  So #epoch reports technically different times
> depending what one's #localOffset is.
> |dt1 dt2| dt1:= '2004-02-29T13:33:00+02:00' asDateAndTime.
> dt2 := '2004-02-29T11:33:00+00:00' asDateAndTime.
> self assert: dt1 = dt2.
> self assert: dt1 asSeconds = dt2 asSeconds.   "fails!"
> This is bad, isn't it?

That's exactly the problem. It gets worse when your localOffset changes, 
or you want to use instances created in different localOffsets.


> On Sat, Dec 3, 2016 at 12:50 PM, Chris Muller <ma.chris.m at gmail.com> wrote:
>>> Do you know the answer to Dave's question "How many seconds elapsed between
>>> the Smalltalk epoch and the time 2004-02-29T13:33:00+02:00?"?
>> IOW, as long as this private, internal number is consistent for the
>> callers, does it matter what the number is?  Whether the internal
>> "starting point" is midnight, 2am, 6am or 7:37:59am for that matter?
>> The comment just says "1 January 1901" it does not specify a time,
>> could we just clarify the exact time in the comment and then
>> everything be fine?
>> Or is there some calculation or scenario for an application that is
>> not consistent and correct due to this?

More information about the Squeak-dev mailing list