[squeak-dev] The Inbox: Chronology-Core-cmm.54.mcz

Tobias Pape Das.Linux at gmx.de
Fri May 1 07:35:32 UTC 2020


a lot of non-core apps use utcMicrosecondClock for benchmarking.

the newly introduced calculation in there will surely affect those.


-1 on changing utcMicrosecondClock  in any way.

-t
> On 01.05.2020, at 05:35, commits at source.squeak.org wrote:
> 
> Chris Muller uploaded a new version of Chronology-Core to project The Inbox:
> http://source.squeak.org/inbox/Chronology-Core-cmm.54.mcz
> 
> ==================== Summary ====================
> 
> Name: Chronology-Core-cmm.54
> Author: cmm
> Time: 30 April 2020, 10:35:37.087886 pm
> UUID: aea28e1f-8f45-4621-938d-61349776e465
> Ancestors: Chronology-Core-nice.52
> 
> - Let #primUtcMicrosecondClock provide access to primitive 240.
> - Let #utcMicrosecondClock be based on the Smalltalk epoch, 1/1/1901 @ 00:00:00.
> - Three legacy senders were left alone pending discussion whether they can use the new #utcMicrosecondClock.
> - Provide DateAndTime class>>#fromUtcMicrosecondClock:, as a supplement to Time class>>#utcMicrosecondClock.
> 
> =============== Diff against Chronology-Core-nice.52 ===============
> 
> Item was added:
> + ----- Method: DateAndTime class>>fromUtcMicrosecondClock: (in category 'smalltalk-80') -----
> + fromUtcMicrosecondClock: anInteger 
> + 	"Answer a DateAndTime the specified microseconds after the Squeak epoch: 1/1/1901 @ 00:00:00."
> + 	^ self
> + 		utcMicroseconds: anInteger
> + 		offset: self localOffsetSeconds!
> 
> Item was changed:
>  ----- Method: Time class>>estimateHighResClockTicksPerMillisecond (in category 'clock') -----
>  estimateHighResClockTicksPerMillisecond
> 
>  	| t0 t1 t2 t3 |
>  	
>  	"Count the ticks ellapsed during a 10ms busy loop"
> + 	t0 := Time primUtcMicrosecondClock + 200.
> + 	[Time primUtcMicrosecondClock >= t0] whileFalse.
> - 	t0 := Time utcMicrosecondClock + 200.
> - 	[Time utcMicrosecondClock >= t0] whileFalse.
>  	t1 := self highResClock.
> + 	[Time primUtcMicrosecondClock >= (t0 + 10000)] whileFalse.
> + 	t1 := self highResClock - t1 * 1000 // (Time primUtcMicrosecondClock - t0).
> - 	[Time utcMicrosecondClock >= (t0 + 10000)] whileFalse.
> - 	t1 := self highResClock - t1 * 1000 // (Time utcMicrosecondClock - t0).
>  	
>  	"Count the ticks ellapsed during a 20ms busy loop"
> + 	t0 := Time primUtcMicrosecondClock + 200.
> + 	[Time primUtcMicrosecondClock >= t0] whileFalse.
> - 	t0 := Time utcMicrosecondClock + 200.
> - 	[Time utcMicrosecondClock >= t0] whileFalse.
>  	t2 := self highResClock.
> + 	[Time primUtcMicrosecondClock >= (t0 + 20000)] whileFalse.
> + 	t2 := self highResClock - t2 * 1000 // (Time primUtcMicrosecondClock - t0).
> - 	[Time utcMicrosecondClock >= (t0 + 20000)] whileFalse.
> - 	t2 := self highResClock - t2 * 1000 // (Time utcMicrosecondClock - t0).
>  	
>  	"Count the ticks ellapsed during a 30ms busy loop"
> + 	t0 := Time primUtcMicrosecondClock + 200.
> + 	[Time primUtcMicrosecondClock >= t0] whileFalse.
> - 	t0 := Time utcMicrosecondClock + 200.
> - 	[Time utcMicrosecondClock >= t0] whileFalse.
>  	t3 := self highResClock.
> + 	[Time primUtcMicrosecondClock >= (t0 + 30000)] whileFalse.
> + 	t3 := self highResClock - t3 * 1000 // (Time primUtcMicrosecondClock - t0).
> - 	[Time utcMicrosecondClock >= (t0 + 30000)] whileFalse.
> - 	t3 := self highResClock - t3 * 1000 // (Time utcMicrosecondClock - t0).
>  	
>  	"Take the median of the 3 estimates as the best"
>  	^ t1 <= t2
>  		ifTrue: [t2 <= t3
>  				ifTrue: [t2]
>  				ifFalse: [t1 <= t3
>  						ifTrue: [t3]
>  						ifFalse: [t1]]]
>  		ifFalse: [t1 <= t3
>  				ifTrue: [t1]
>  				ifFalse: [t2 <= t3
>  						ifTrue: [t3]
>  						ifFalse: [t2]]]!
> 
> Item was changed:
>  ----- Method: Time class>>localMicrosecondClock (in category 'clock') -----
>  localMicrosecondClock
>  	"Answer the local microseconds since the Smalltalk epoch (January 1st 1901, the start of the 20th century).
>  	 The value is derived from the current UTC wallclock time and the image's current notion of time zone."
> + 	^self primUtcMicrosecondClock + (DateAndTime localOffset asSeconds * 1000000)!
> - 	^self utcMicrosecondClock + (DateAndTime localOffset asSeconds * 1000000)!
> 
> Item was changed:
>  ----- Method: Time class>>millisecondClockValue (in category 'general inquiries') -----
>  millisecondClockValue
>  	"Answer the value of the millisecond clock."
> 
> + 	^self primUtcMicrosecondClock // 1000!
> - 	^self utcMicrosecondClock // 1000!
> 
> Item was added:
> + ----- Method: Time class>>primUtcMicrosecondClock (in category 'private') -----
> + primUtcMicrosecondClock
> + 	"Answer the UTC microseconds since the Smalltalk epoch (January 1st 1901, the start of the 20th century).
> + 	 The value is derived from the Posix epoch with a constant offset corresponding to elapsed microseconds
> + 	 between the two epochs according to RFC 868."
> + 	<primitive: 240>
> + 	^0!
> 
> Item was changed:
>  ----- Method: Time class>>utcMicrosecondClock (in category 'clock') -----
>  utcMicrosecondClock
>  	"Answer the UTC microseconds since the Smalltalk epoch (January 1st 1901, the start of the 20th century).
>  	 The value is derived from the Posix epoch with a constant offset corresponding to elapsed microseconds
>  	 between the two epochs according to RFC 868."
> + 	^ self primUtcMicrosecondClock - (DateAndTime daysFromSmalltalkEpochToPosixEpoch*MicrosecondsInDay)!
> - 	<primitive: 240>
> - 	^0!
> 
> 




More information about the Squeak-dev mailing list