[squeak-dev] The Inbox: Chronology-Tests-dtl.8.mcz

commits at source.squeak.org commits at source.squeak.org
Sun Dec 4 17:40:06 UTC 2016


David T. Lewis uploaded a new version of Chronology-Tests to project The Inbox:
http://source.squeak.org/inbox/Chronology-Tests-dtl.8.mcz

==================== Summary ====================

Name: Chronology-Tests-dtl.8
Author: dtl
Time: 4 December 2016, 12:39:59.762389 pm
UUID: 778d4c7e-448d-41f9-8aa2-18bfc6d6c3ce
Ancestors: Chronology-Tests-dtl.7

DateAndTime asSeconds should refer to seconds since the Smalltalk epoch.

=============== Diff against Chronology-Tests-dtl.7 ===============

Item was added:
+ ----- Method: DateAndTimeTest>>testAsSeconds (in category 'Tests') -----
+ testAsSeconds
+ 	"Verify seconds elapsed from the Smalltalk epoch until a specified DateAndTime 2004-02-29T13:33:00+02:00"
+ 
+ 	| aDateAndTime first28DaysOfFebruary2004 firstElevenHoursOfFebruary29 monthOfJanuary2004 posixEpochUntilJanuary2004 smalltalkEpochUntilPosixEpoch thirtyThreeMinutesOfTheEleventhHour totalElapsedSeconds |
+ 
+ 	aDateAndTime := (DateAndTime year: 2004 month: 2 day: 29 hour: 13 minute: 33 second: 0 offset: 2 hours).
+ 	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.
+ 	self assert: totalElapsedSeconds equals: aDateAndTime asSeconds. "3255507180"
+ !



More information about the Squeak-dev mailing list