[Pkg] The Trunk: Kernel-klc.493.mcz

commits at source.squeak.org commits at source.squeak.org
Sun Sep 12 21:38:11 UTC 2010

Ken Causey uploaded a new version of Kernel to project The Trunk:

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

Name: Kernel-klc.493
Author: klc
Time: 12 September 2010, 4:37:22.016 pm
UUID: 2160992d-b8c1-a246-8dfe-751abbb9f685
Ancestors: Kernel-nice.492

This makes two significant changes to DateAndTime/TimeStamp either of which fixes a number of TimeStamp tests.

1.  Ensure that when the date is extracted from either DateAndTime or TimeStamp that the date is defined in terms of a DateAndTime.

2.  If a TimeStamp and a DateAndTime represent equivalent instances in time then allow #= to return true when comparing them.

These changes may be controversial.  As mentioned when I discussed this on the #squeak IRC channel there are conceptual differences between TimeStamps and DateAndTimes.  I don't disagree with this notion, however that is not how TimeStamp is implemented currently in Squeak.  I admit I'm taking the easier approach since I would have to give some serious thought and research into a 'proper' redesign of TimeStamp.

For now these changes make TimeStamp/DateAndTime at least work like they seem to be expected to based on the tests.

=============== Diff against Kernel-nice.492 ===============

Item was changed:
  ----- Method: DateAndTime>>= (in category 'ansi protocol') -----
+ = aDateAndTimeOrTimeStamp 
+ 	self == aDateAndTimeOrTimeStamp ifTrue: [ ^ true ].
+ 	((aDateAndTimeOrTimeStamp isKindOf: self class)
+ 		or: [aDateAndTimeOrTimeStamp isKindOf: DateAndTime orOf: TimeStamp])
+ 			ifFalse: [ ^ false ].
+ 	^ self offset = aDateAndTimeOrTimeStamp offset
+ 		ifTrue: [ self hasEqualTicks: aDateAndTimeOrTimeStamp ]
+ 		ifFalse: [ self asUTC ticks = aDateAndTimeOrTimeStamp asUTC ticks ]!
- = aDateAndTime 
- 	self == aDateAndTime ifTrue: [ ^ true ].
- 	(aDateAndTime isKindOf: self class) ifFalse: [ ^ false ].
- 	^ self offset = aDateAndTime offset
- 		ifTrue: [ self hasEqualTicks: aDateAndTime ]
- 		ifFalse: [ self asUTC ticks = aDateAndTime asUTC ticks ]!

Item was changed:
  ----- Method: DateAndTime>>asDate (in category 'squeak protocol') -----
+ 	^ Date starting: self asDateAndTime!
- 	^ Date starting: self!

Item was added:
+ ----- Method: TimeStamp>>asDateAndTime (in category 'squeak protocol') -----
+ asDateAndTime
+ 	"Answer the receiver as an instance of DateAndTime."
+ 	^ DateAndTime new setJdn: jdn seconds: seconds nano: nanos offset: offset!

More information about the Packages mailing list