Levente Uzonyi uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-ul.977.mcz ==================== Summary ==================== Name: Kernel-ul.977 Author: ul Time: 10 January 2016, 10:25:16.755989 pm UUID: aaa18bc1-b66d-47b3-b755-f87c223fa959 Ancestors: Kernel-eem.976 DateAndTime changes and fixes: - #now returns an object with the correct date. (DaysSinceEpoch was only updated in #startUp:, so after a day it became inaccurate.) - #now returns increasing values, as it did before. - Removed the unused DaysSinceEpoch class variable. - Removed #startUp:, because it had nothing else left to do. - DateAndTime is removed from the StartUpList after load. - #julianDayNumber:offset: uses the direct setter method, which results in ~55x speedup. =============== Diff against Kernel-eem.976 =============== Item was changed: Magnitude subclass: #DateAndTime instanceVariableNames: 'seconds offset jdn nanos' + classVariableNames: 'ClockProvider LastClockValue LocalTimeZone NanoOffset' - classVariableNames: 'ClockProvider DaysSinceEpoch LocalTimeZone' poolDictionaries: 'ChronologyConstants' category: 'Kernel-Chronology'! !DateAndTime commentStamp: 'brp 5/13/2003 08:07' prior: 0! I represent a point in UTC time as defined by ISO 8601. I have zero duration. My implementation uses three SmallIntegers and a Duration: jdn - julian day number. seconds - number of seconds since midnight. nanos - the number of nanoseconds since the second. offset - duration from UTC. The nanosecond attribute is almost always zero but it defined for full ISO compliance and is suitable for timestamping. ! Item was changed: ----- Method: DateAndTime class>>julianDayNumber:offset: (in category 'squeak protocol') ----- julianDayNumber: anInteger offset: aDuration + + ^self basicNew + setJdn: anInteger + seconds: 0 + nano: 0 + offset: aDuration! - ^ self basicNew - ticks: anInteger days ticks - offset: aDuration ; - yourself! Item was changed: ----- Method: DateAndTime class>>nowWithOffset: (in category 'squeak protocol') ----- + nowWithOffset: aDuration + + | clockValue nanos | + clockValue := Time utcMicrosecondClock. + "Ensure that consecutive sends of this method return increasing values, by adding small values to the nanosecond part of the created object. The next few lines are assumed to be executed atomically - having no suspension points." + ((LastClockValue ifNil: [ 0 ]) digitCompare: clockValue) = 0 + ifTrue: [ NanoOffset := NanoOffset + 1 ] + ifFalse: [ NanoOffset := 0 ]. + LastClockValue := clockValue. + nanos := clockValue \\ 1000000 * 1000 + NanoOffset. + clockValue := clockValue // 1000000. - nowWithOffset: aDuration - | usecs | - usecs := Time utcMicrosecondClock. ^self basicNew + setJdn: clockValue // SecondsInDay + SqueakEpoch + seconds: clockValue \\ SecondsInDay + nano: nanos - setJdn: DaysSinceEpoch - seconds: usecs // 1000000 \\ SecondsInDay - nano: usecs \\ 1000000 * 1000 offset: aDuration! Item was removed: - ----- Method: DateAndTime class>>startUp: (in category 'initialize-release') ----- - startUp: resuming - | durationSinceEpoch | - resuming ifFalse: [^self]. - durationSinceEpoch := Duration - days: SqueakEpoch - hours: 0 - minutes: 0 - seconds: self clock totalSeconds. - DaysSinceEpoch := durationSinceEpoch days! Item was added: + (PackageInfo named: 'Kernel') postscript: 'Smalltalk removeFromStartUpList: DateAndTime.'! |
Free forum by Nabble | Edit this page |