[squeak-dev] DateAndTimeLeapTest>>testAsSeconds is broken

David T. Lewis lewis at mail.msen.com
Sun Dec 4 04:29:47 UTC 2016


On Fri, Dec 02, 2016 at 10:48:30PM +0100, Levente Uzonyi wrote:
> On Fri, 2 Dec 2016, Chris Muller wrote:
> 
> >>>It's also quit possible I'm totally confused - I did not use independent
> >>>resources but was just relying on Squeak.
> >>>
> >>
> >>Well yes, of course you are confused, you should be. I would have been 
> >>very
> >>worried if you looked at this and thought that it made any sense ;-)
> >
> >I haven't quite groked the issue myself just yet, but you definitely
> >sound convinced there's a tangible issue, Dave.  I agree that symmetry
> >between those two converting methods sounds like it should be..
> >
> >You said the number of seconds calculated since the "epoch" is wrong
> >but mentioned it was merely in conflict with a comment.  If we "fixed"
> >the comment, would we still have a problem?
> 
> 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?"?
> 
> Levente
>

In a workspace:

smalltalkEpochUntilPosixEpoch := 24 * 60 * 60 * ((52*365) + (17*366)).

posixEpochUntilJanuary2004 := 24 * 60 * 60 * ((26*365) + (8*366)).

monthOfJanuary2004 := 31 * 24 * 60 * 60.

first28DaysOfFebruary2004 := 28 * 24 * 60 * 60.

firstElevenHoursOfFebruary29 := 11 * 60 * 60.

thirtyThreeMinutesOfTheEleventhHour := 33 * 60.

totalElapsedSeconds := smalltalkEpochUntilPosixEpoch + posixEpochUntilJanuary2004 + monthOfJanuary2004 + first28DaysOfFebruary2004 + firstElevenHoursOfFebruary29 + thirtyThreeMinutesOfTheEleventhHour.

totalElapsedSeconds. "==> 3255507180"

"Below works only if UTCDateAndTime is installed, else figure it out by hand"
(DateAndTime fromSeconds: totalElapsedSeconds) localOffsetSeconds: 2 * 60 * 60 ; yourself. "==> 2004-02-29T13:33:00+02:00"

 


More information about the Squeak-dev mailing list