[squeak-dev] DateAndTimeLeapTest>>testAsSeconds is broken

Chris Muller asqueaker at gmail.com
Sun Dec 4 00:29:34 UTC 2016

On Sat, Dec 3, 2016 at 6:03 PM, David T. Lewis <lewis at mail.msen.com> wrote:
> On Wed, Nov 30, 2016 at 10:51:05PM -0500, David T. Lewis wrote:
>> DateAndTimeLeapTest>>testAsSeconds is broken. The test passes incorrectly as a
>> result of a false assertion:
>>       self assert: aDateAndTime asSeconds = 3255514380.
>> Where aDateAndTime is specified in #setUp
>>       aDateAndTime := (DateAndTime year: 2004 month: 2 day: 29 hour: 13 minute: 33 second: 0 offset: 2 hours).
>> This time is 2004-02-29T13:33:00+02:00, which in UTC is 2004-02-29T11:33:00+00:00.
>> The #asSeconds tests should test for elapsed seconds from the Smalltalk epoch
>> until 2004-02-29T11:33:00+00:00. The correct number of seconds for this duration
>> is 3255507180, not 3255514380 as asserted in the unit test.
>> By definition, #asSeconds is the seconds elapsed since the Smalltalk epoch
>> (see its method comment). By common agreement, the Smalltalk epoch was defined
>> relative to Greenwich Mean Time (UTC). If these two statements are both true,
>> then the test is broken.
>> If there is no disagreement, I will fix the test and allow it to show the failure.
> This thread has generated some interesting discussion, but my original
> question remains.
> The correct number of elapsed seconds from the Smalltalk epoch to
> 2004-02-29T13:33:00+02:00 is 3255507180. I want to change #testAsSeconds
> assert this value. The test will fail, as it should.
> Any objections?

How do you count non-responses?  ;)

No objection from me, but since we're talking about persistent data,
this deserves some good patient thought so we're sure we really want
to change the meaning of #epoch to be a globalized constant rather
than a timezone-specific one.  If we do, then that test should be
fixed along with the other two methods, too.

More information about the Squeak-dev mailing list