[squeak-dev] The Trunk: Chronology-Core-dtl.17.mcz

commits at source.squeak.org commits at source.squeak.org
Fri Jan 4 14:10:44 UTC 2019


David T. Lewis uploaded a new version of Chronology-Core to project The Trunk:
http://source.squeak.org/trunk/Chronology-Core-dtl.17.mcz

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

Name: Chronology-Core-dtl.17
Author: dtl
Time: 31 December 2018, 4:49:57.271035 am
UUID: ae57904f-33ef-4614-9702-d2d148821f4f
Ancestors: Chronology-Core-dtl.16

Bootstrap UTCDateAndTime, step 2 of 5

Start using LXDateAndTime instead of DateAndTime.
Change instance creation in DateAndTime to create LXDateAndTime instances instead.
In the postscript, have all DateAndTime instances become LXDateAndTime.

=============== Diff against Chronology-Core-dtl.16 ===============

Item was added:
+ ServiceProvider subclass: #ChronologyCoreServiceProvider
+ 	instanceVariableNames: ''
+ 	classVariableNames: ''
+ 	poolDictionaries: ''
+ 	category: 'Chronology-Core'!

Item was added:
+ ----- Method: ChronologyCoreServiceProvider class>>initialize (in category 'initialization') -----
+ initialize 
+ 	ServiceRegistry current buildProvider: self new!

Item was changed:
  ----- Method: DateAndTime class>>fromSeconds: (in category 'smalltalk-80') -----
  fromSeconds: seconds 
  	"Answer a DateAndTime since the Squeak epoch: 1 January 1901"
  
+ 	^ LXDateAndTime fromSeconds: seconds
+ 
+ 	"| integerSeconds nanos |
- 	| integerSeconds nanos |
  	integerSeconds := seconds truncated.
  	integerSeconds = seconds
  		ifTrue: [nanos := 0]
  		ifFalse: [nanos := (seconds - integerSeconds * NanosInSecond) asInteger].
  	^ self basicNew
  		ticks: (Array
  				with: SqueakEpoch
  				with: integerSeconds
  				with: nanos)
+ 		offset: self localOffset"!
- 		offset: self localOffset!

Item was changed:
  ----- Method: DateAndTime class>>julianDayNumber:offset: (in category 'squeak protocol') -----
  julianDayNumber: anInteger offset: aDuration 
  
+ 	^ LXDateAndTime julianDayNumber: anInteger offset: aDuration
+ 
+ 	"^self basicNew
- 	^self basicNew
  		setJdn: anInteger
  		seconds: 0
  		nano: 0
+ 		offset: aDuration"!
- 		offset: aDuration!

Item was changed:
  ----- Method: DateAndTime class>>now (in category 'ansi protocol') -----
  now
+ 
+ 	^LXDateAndTime now.
+ 
+ 	"| clockAndOffset localSeconds |
- 	| clockAndOffset localSeconds |
  	clockAndOffset := self clock utcMicrosecondClockWithOffset.
  	localSeconds := self localOffset asSeconds.
  	(self automaticTimezone and: [localSeconds ~= clockAndOffset second])
  		ifTrue: [self setLocalOffsetAutomatically: (Duration seconds: (localSeconds := clockAndOffset second))].
+ 	^self now: clockAndOffset first + (localSeconds * 1000000) offset: self localOffset"!
- 	^self now: clockAndOffset first + (localSeconds * 1000000) offset: self localOffset!

Item was changed:
  ----- Method: LXDateAndTime>>= (in category 'ansi protocol') -----
  = aDateAndTimeOrTimeStamp
  	"Equal if the absolute time values match, regardless of local time transform"
  	self == aDateAndTimeOrTimeStamp ifTrue: [ ^ true ].
  	^aDateAndTimeOrTimeStamp species == DateAndTime
+ 		and: [ utcMicroseconds = aDateAndTimeOrTimeStamp asLXDateAndTime utcMicroseconds ]!
- 		and: [ utcMicroseconds = aDateAndTimeOrTimeStamp utcMicroseconds ]!

Item was added:
+ ----- Method: LXDateAndTime>>asLXTimeStamp (in category 'transitional - temporary') -----
+ asLXTimeStamp
+ 
+ 	^ self as: LXTimeStamp!

Item was changed:
  ----- Method: LXDateAndTime>>asTimeStamp (in category 'squeak protocol') -----
  asTimeStamp
  
+ 	^ self asDateAndTime asTimeStamp
+ !
- 	^ self
- 		asDateAndTime "FIXME LX hack for test support"
- 		as: TimeStamp!

Item was added:
+ ----- Method: LXDateAndTime>>hasEqualTicks: (in category 'private') -----
+ hasEqualTicks: aDateAndTime
+ 	
+ 	^ (self julianDayNumber = aDateAndTime julianDayNumber)
+ 		and: [ (self secondsSinceMidnight = aDateAndTime secondsSinceMidnight)
+ 			and: [ self nanoSecond = aDateAndTime nanoSecond ] ]
+ !

Item was added:
+ ----- Method: LXDateAndTime>>noTimezone (in category 'private') -----
+ noTimezone
+ 	^ false!

Item was changed:
  ----- Method: TimeStamp class>>current (in category 'squeak protocol') -----
  current
  
+ 	^LXTimeStamp current
+ 
+ 	"| ts ticks |
- 	| ts ticks |
  	ts := super now asTimeStamp.
  	ticks := ts ticks.
  	ticks at: 3 put: 0.
  	ts ticks: ticks offset: ts offset.
+ 	^ ts"
- 	^ ts
  !

Item was added:
+ ----- Method: TimeStamp class>>year:month:day:hour:minute:second:nanoSecond:offset: (in category 'squeak protocol') -----
+ year: year month: month day: day hour: hour minute: minute second: second nanoSecond: nanoCount offset: offset
+ 	"Return a DateAndTime"
+ 
+ 	^ LXTimeStamp year: year month: month day: day hour: hour minute: minute second: second nanoSecond: nanoCount offset: offset
+ 
+ !

Item was added:
+ ----- Method: TimeStamp>>asLXTimeStamp (in category 'LX-Kernel-Chronology') -----
+ asLXTimeStamp
+ 
+ 	^self asLXDateAndTime asLXTimeStamp!

Item was added:
+ (PackageInfo named: 'Chronology-Core') postscript: '"Convert all instances of DateAndTime and TimeStamp to the equivalent LXDateAndTime and LXTimeStamp."
+ 
+ | oldInstances newInstances |
+ Smalltalk garbageCollect.
+ oldInstances := DateAndTime allInstances, TimeStamp allInstances.
+ newInstances := oldInstances collect: [ :each |
+         each class == DateAndTime
+                 ifTrue: [ each asLXDateAndTime ]
+                 ifFalse: [ each asLXTimeStamp ] ].
+ oldInstances elementsForwardIdentityTo: newInstances.
+ Smalltalk garbageCollect.
+ '!



More information about the Squeak-dev mailing list