'This changeset was generated by squeaksource, it might need manual editing'! "Change Set: Kernel-dtl.569(cmm.568) Date: 14 April 2011 Author: (generated from MC packages below) Name: Kernel-dtl.569 Author: dtl Time: 14 April 2011, 9:48:42.876 pm UUID: c1d30608-4cc8-4db7-204a-2bf7a46c1508 Ancestors: Kernel-cmm.568 If the VM supports primitiveMillisecondClockMask, use this at image startup time to obtain the millisecond clock mask value, otherwise use a default of 16r1FFFFFFF. Maintain the mask value in a class variable for speed, and use this for duration calculations associated with the millisecond clock. Background - the millisecond clock in the VM rolls over when its value exceeds the mask value. The image may calculate durations (e.g. socket timeout values) using the millisecond clock, in which case the mask value is used to detect clock rollover. By making the mask value available through a primitive, the image can be assured that its mask value is the same as that being used in the VM. If the primitive is not available, the image should assume use of the traditional mask value 16r1FFFFFFF."! Magnitude subclass: #Time instanceVariableNames: 'seconds nanos' classVariableNames: 'MillisecondClockMask' poolDictionaries: 'ChronologyConstants' category: 'Kernel-Chronology'! !Time commentStamp: 'dew 10/23/2004 17:58' prior: 0! This represents a particular point in time during any given day. For example, '5:19:45 pm'. If you need a point in time on a particular day, use DateAndTime. If you need a duration of time, use Duration. ! !DateAndTime class methodsFor: 'initialize-release' stamp: 'dtl 4/13/2011 08:10'! startUp: resuming resuming ifFalse: [ ^ self ]. Time initializeMillisecondClockMask. OffsetsAreValid := false. [ self initializeOffsets. OffsetsAreValid := true ] forkAt: Processor userInterruptPriority.! ! !Time class methodsFor: 'clock' stamp: 'dtl 4/13/2011 08:09'! initializeMillisecondClockMask "Initialize cached value from the VM, or set to nil if VM cannot support the request" MillisecondClockMask := self primMillisecondClockMask ! ! !Time class methodsFor: 'general inquiries' stamp: 'dtl 4/13/2011 08:06'! millisecondClockMask "Answer the mask used for millisecond clock rollover in the virtual machine. Answer a default if the VM cannot supply the value." ^MillisecondClockMask ifNil: [16r1FFFFFFF] ! ! !Time class methodsFor: 'squeak protocol' stamp: 'dtl 4/13/2011 08:05'! milliseconds: currentTime since: lastTime "Answer the elapsed time since last recorded in milliseconds. Compensate for rollover." | delta | delta := currentTime - lastTime. ^ delta < 0 ifTrue: [self millisecondClockMask + delta] ifFalse: [delta]! ! !Time class methodsFor: 'clock' stamp: 'dtl 4/13/2011 08:02'! primMillisecondClockMask "Answer the mask value used for millisecond clock rollover in the virtual machine, or nil if the VM cannot support the request." ^nil! !