[squeak-dev] The Inbox: Chronology-Core-ct.80.mcz

commits at source.squeak.org commits at source.squeak.org
Thu Jul 14 14:15:26 UTC 2022


A new version of Chronology-Core was added to project The Inbox:
http://source.squeak.org/inbox/Chronology-Core-ct.80.mcz

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

Name: Chronology-Core-ct.80
Author: ct
Time: 10 June 2022, 7:15:27.575345 pm
UUID: 1b24fec7-ca29-9e47-8951-34966ea11088
Ancestors: Chronology-Core-dtl.79

Merges fix-busyWait-precision:
	Fixes #busyWait for durations < 1 milliSecond. Since the original proposal (Chronology-Core-ct.67), the implementation had been moved from Duration to Delay (Chronology-Core-mt.71). However, Delay has only milliseconds precision, causing shorter durations to be handled as a delayDuration of 0 milliSeconds and leading to this erroneous output:
	
		[1 microSeconds busyWait] bench '6,240,000 per second. 160 nanoseconds per run. 0.67973 % GC time.'

Revision:
	Moves #busyWait implementation back to Duration and removes non-idiomatic Delay>>#busyWait without deprecation.

For more information, see: https://lists.squeakfoundation.org/pipermail/squeak-dev/2022-May/220378.html

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

Item was removed:
- SystemOrganization addCategory: #'Chronology-Core'!

Item was removed:
- ----- Method: BlockClosure>>bench (in category '*chronology-core') -----
- bench
- 	"See how many times I can value in 5 seconds.  I'll answer a meaningful description."
- 
- 	^self benchFor: 5 seconds!

Item was removed:
- ----- Method: BlockClosure>>benchFor: (in category '*chronology-core') -----
- benchFor: aDuration
- 	"See how many times I can value within the given duration.  I'll answer a meaningful description."
- 
- 	| startTime shouldRun count elapsedTime roundTo3Digits delay gcStart gcTime |
- 	roundTo3Digits := [:num |
- 		| rounded lowDigit |
- 		rounded := (num * 1000) rounded. "round to 1/1000"
- 		lowDigit := (rounded numberOfDigitsInBase: 10) - 3. "keep only first 3 digits"
- 		rounded := rounded roundTo:(10 raisedTo: lowDigit).
- 		(lowDigit >= 3 or: [rounded \\ 1000 = 0]) "display fractional part only when needed"
- 			ifTrue: [(rounded // 1000) asStringWithCommas]
- 			ifFalse: [(rounded / 1000.0) printString]].
- 	delay := aDuration asDelay.
- 	count := 0.
- 	shouldRun := true.
- 	Smalltalk garbageCollect.
- 	[ delay wait. shouldRun := false ] forkAt: Processor timingPriority - 1.
- 	startTime := Time millisecondClockValue.
- 	gcStart := (Smalltalk vmParameterAt: 8) + (Smalltalk vmParameterAt: 10).
- 	[ shouldRun ] whileTrue: [ 
- 		self value.
- 		count := count + 1 ].
- 	elapsedTime := Time millisecondsSince: startTime.
- 	gcTime := (Smalltalk vmParameterAt: 8) + (Smalltalk vmParameterAt: 10) - gcStart.
- 	^(roundTo3Digits value: count * 1000 / elapsedTime) , ' per second.', ((
- 		#(
- 			(1e-3 'seconds')
- 			(1 'milliseconds')
- 			(1e3 'microseconds')
- 			(1e6 'nanoseconds')
- 		)
- 			detect: [ :pair | elapsedTime * pair first >= count ]
- 			ifNone: [ #(1e9 'picoseconds') ])
- 		in: [ :pair |
- 			' {1} {2} per run.' format: {
- 				(roundTo3Digits value: elapsedTime * pair first / count).
- 				pair second } ]), (' {1} % GC time.' format: {gcTime / elapsedTime * 100 printShowingMaxDecimalPlaces: 5})!

Item was removed:
- ----- Method: BlockClosure>>durationToRun (in category '*chronology-core') -----
- durationToRun
- 	"Answer the duration taken before this block returns."
- 
- 	^ Time durationToRun: self
- !

Item was removed:
- ----- Method: BlockClosure>>timeToRun (in category '*chronology-core') -----
- timeToRun
- 	"Answer the number of milliseconds taken to execute this block."
- 
- 	^ Time millisecondsToRun: self
- !

Item was removed:
- ----- Method: BlockClosure>>timeToRunWithoutGC (in category '*chronology-core') -----
- timeToRunWithoutGC
- 	"Answer the number of milliseconds taken to execute this block without GC time."
- 
- 	^(Smalltalk vmParameterAt: 8) + 
- 		(Smalltalk vmParameterAt: 10) +
- 		self timeToRun -
- 		(Smalltalk vmParameterAt: 8) - 
- 		(Smalltalk vmParameterAt: 10)
- !

Item was removed:
- ----- Method: BlockClosure>>valueWithin:onTimeout: (in category '*chronology-core') -----
- valueWithin: aDuration onTimeout: timeoutBlock
- 	"Evaluate the receiver.
- 	If the evaluation does not complete in less than aDuration evaluate the timeoutBlock instead"
- 
- 	| theProcess delay watchdog tag |
- 
- 	aDuration <= Duration zero ifTrue: [^ timeoutBlock value ].
- 
- 	"the block will be executed in the current process"
- 	theProcess := Processor activeProcess.
- 	delay := aDuration asDelay.
- 	tag := self.
- 
- 	"make a watchdog process"
- 	watchdog := [
- 		delay wait. 	"wait for timeout or completion"
- 		theProcess ifNotNil:[ theProcess signalException: (TimedOut new tag: tag)] 
- 	] newProcess.
- 
- 	"Watchdog needs to run at high priority to do its job (but not at timing priority)"
- 	watchdog priority: Processor timingPriority-1.
- 
- 	"catch the timeout signal"
- 	^ [	watchdog resume.				"start up the watchdog"
- 		self ensure:[						"evaluate the receiver"
- 			theProcess := nil.				"it has completed, so ..."
- 			delay delaySemaphore signal.	"arrange for the watchdog to exit"
- 		]] on: TimedOut do: [ :e | 
- 			e tag == tag 
- 				ifTrue:[ timeoutBlock value ]
- 				ifFalse:[ e pass]].!

Item was removed:
- SharedPool subclass: #ChronologyConstants
- 	instanceVariableNames: ''
- 	classVariableNames: 'DayNames DaysInMonth MicrosecondsInDay MonthNames NanosInMillisecond NanosInSecond OneDay SecondsInDay SecondsInHour SecondsInMinute SqueakEpoch Zero'
- 	poolDictionaries: ''
- 	category: 'Chronology-Core'!
- 
- !ChronologyConstants commentStamp: 'brp 3/12/2004 14:34' prior: 0!
- ChronologyConstants is a SharedPool for the constants used by the Kernel-Chronology classes.!

Item was removed:
- ----- Method: ChronologyConstants class>>initialize (in category 'class initialization') -----
- initialize
- 	"ChronologyConstants initialize" 	
- 		
- 	SqueakEpoch := 2415386. 		"Julian day number of 1 Jan 1901" 
- 	SecondsInDay := 86400.
- 	SecondsInHour := 3600.
- 	SecondsInMinute := 60.
- 	MicrosecondsInDay := 24 * 60 * 60 * 1000000.
- 	NanosInSecond := 10 raisedTo: 9.
- 	NanosInMillisecond := 10 raisedTo: 6.
- 	DayNames := #(Sunday Monday Tuesday Wednesday Thursday Friday Saturday).
- 		
- 	MonthNames := #(	January February March April May June
- 						July August September October November December).
- 	DaysInMonth := #(31 28 31 30 31 30 31 31 30 31 30 31)!

Item was removed:
- Timespan subclass: #Date
- 	instanceVariableNames: ''
- 	classVariableNames: ''
- 	poolDictionaries: 'ChronologyConstants'
- 	category: 'Chronology-Core'!
- 
- !Date commentStamp: 'cmm 6/28/2016 21:36' prior: 0!
- Instances of Date are Timespans with duration of 1 day.  As with all Chronology Timespan sub-instances, Dates can be instantiated as position values which compare equally to any other instance of the same Date, irregardless of the timezone in which either is created.
- 
- However, like the other Timespan subInstances, there are rare cases where it may be desirable to use instances of Date to represent a particular 1-day span of time at a particular locality on the globe.  All Timespans, including Dates, may specify a particular timezone offset for this purpose.!

Item was removed:
- ----- Method: Date class>>dateAndTimeNow (in category 'smalltalk-80') -----
- dateAndTimeNow
- 	"Answer an Array whose with Date today and Time now."
- 
- 	^ Time dateAndTimeNow
- !

Item was removed:
- ----- Method: Date class>>dayOfWeek: (in category 'smalltalk-80') -----
- dayOfWeek: dayName 
- 
- 	^ Week indexOfDay: dayName!

Item was removed:
- ----- Method: Date class>>daysInMonth:forYear: (in category 'smalltalk-80') -----
- daysInMonth: monthName forYear: yearInteger 
- 
- 	^ Month daysInMonth: monthName forYear: yearInteger.
- !

Item was removed:
- ----- Method: Date class>>daysInYear: (in category 'smalltalk-80') -----
- daysInYear: yearInteger 
- 
- 	^ Year daysInYear: yearInteger.!

Item was removed:
- ----- Method: Date class>>easterDateFor: (in category 'general inquiries') -----
- easterDateFor: year
- 
-  "  compute the easter date.
-     source: Physikalisch-Technische Bundesanstalt Braunschweig.
-     Lichtenberg, H.: Zur Interpretation der Gaussschen Osterformel
-                      und ihrer Ausnahmeregeln,
-                      Historia Mathematica 24 (1997), pp. 441-444
-   
-     http://www.ptb.de/de/org/4/44/441/oste.htm
-   "
- 
-   | k m s a d r og sz oe day |
- 
-   k := year // 100.
-   m := 15 + (3*k + 3//4) - (8*k + 13//25).
-    s := 2 - (3*k + 3// 4).
-   a := year \\ 19.
-   d := 19*a + m \\ 30.
-   r := d//29 + ((d//28) - (d//29)* (a// 11)).
- 
-   og := 21 + d - r.
-   sz := 7 - (year//4 + year + s\\7).
-   oe := 7 - (og - sz\\7).
-   day := og + oe.
-   ^day <= 31
-     ifTrue: [Date newDay: day month: 3 year: year ]
-     ifFalse: [Date newDay: day - 31 month: 4 year: year].!

Item was removed:
- ----- Method: Date class>>firstWeekdayOfMonth:year: (in category 'smalltalk-80') -----
- firstWeekdayOfMonth: month year: year
- 	"Answer the weekday index of the first day in <month> in the <year>."
- 
- 	^ (self newDay: 1 month: month year: year) weekdayIndex
- !

Item was removed:
- ----- Method: Date class>>fromDays: (in category 'smalltalk-80') -----
- fromDays: dayCount 
- 	"Days since 1 January 1901"
- 
- 	^ self julianDayNumber: dayCount + SqueakEpoch!

Item was removed:
- ----- Method: Date class>>fromSeconds: (in category 'smalltalk-80') -----
- fromSeconds: seconds
- 	"Answer an instance of me which is 'seconds' seconds after January 1, 1901."
- 
- 	^ self fromDays: ((Duration seconds: seconds) days)
- !

Item was removed:
- ----- Method: Date class>>fromString: (in category 'squeak protocol') -----
- fromString: aString
- 	"Answer an instance of created from a string with format mm.dd.yyyy."
- 
- 	^ self readFrom: aString readStream.!

Item was removed:
- ----- Method: Date class>>indexOfMonth: (in category 'smalltalk-80') -----
- indexOfMonth: aMonthName 
- 
- 	^ Month indexOfMonth: aMonthName.
- !

Item was removed:
- ----- Method: Date class>>julianDayNumber: (in category 'squeak protocol') -----
- julianDayNumber: aJulianDayNumber 
- 	^ self starting:
- 		(DateAndTime
- 			julianDayNumber: aJulianDayNumber
- 			offset: self defaultOffset)!

Item was removed:
- ----- Method: Date class>>leapYear: (in category 'smalltalk-80') -----
- leapYear: yearInteger 
- 
- 	^ Year leapYear: yearInteger!

Item was removed:
- ----- Method: Date class>>nameOfDay: (in category 'smalltalk-80') -----
- nameOfDay: dayIndex 
- 
- 	^ Week nameOfDay: dayIndex !

Item was removed:
- ----- Method: Date class>>nameOfMonth: (in category 'smalltalk-80') -----
- nameOfMonth: anIndex 
- 
- 	^ Month nameOfMonth: anIndex.
- !

Item was removed:
- ----- Method: Date class>>newDay:month:year: (in category 'smalltalk-80') -----
- newDay: day month: month year: year 
- 
- 	^ self year: year month: month day: day
- !

Item was removed:
- ----- Method: Date class>>newDay:year: (in category 'smalltalk-80') -----
- newDay: dayCount year: yearInteger
- 
- 	^ self year: yearInteger day: dayCount!

Item was removed:
- ----- Method: Date class>>orthodoxEasterDateFor: (in category 'general inquiries') -----
- orthodoxEasterDateFor: year
- 
-  "  compute the easter date according to the rules of the orthodox calendar.
-     source: 
-     http://www.smart.net/~mmontes/ortheast.html 
-   "
-      | r1 r2 r3 r4 ra rb r5 rc date |
- 
-     r1 := year \\ 19.
-     r2 := year \\ 4.
-     r3 := year \\ 7.
-     ra := 19*r1 + 16.
-     r4 := ra \\ 30.
-     rb := r2 + r2 + (4*r3) + (6*r4).
-     r5 := rb \\ 7.
-     rc := r4 + r5.
-     date := Date newDay: 3 month: 4 year: year.
-     ^date addDays: rc.!

Item was removed:
- ----- Method: Date class>>readFrom: (in category 'squeak protocol') -----
- readFrom: aStream 
- 	"Read a Date from the stream in any of the forms:  
- 		<day> <month> <year>		(15 April 1982; 15-APR-82; 15.4.82; 15APR82)  
- 		<month> <day> <year>		(April 15, 1982; 4/15/82)
- 		<year>-<month>-<day>			(1982-04-15) (ISO8601)"
- 	| ymd |
- 	ymd := self readYearMonthDayFrom: aStream.
- 	^ self
- 		year: ymd first
- 		month: ymd second
- 		day: ymd third
- !

Item was removed:
- ----- Method: Date class>>readFrom:pattern: (in category 'squeak protocol') -----
- readFrom: inputStream pattern: pattern
- 	"Read a Date from the stream based on the pattern which can include the tokens:
- 	
- 		y = A year with 1-n digits
- 		yy = A year with 2 digits
- 		yyyy = A year with 4 digits
- 		m = A month with 1-n digits
- 		mm = A month with 2 digits
- 		d = A day with 1-n digits
- 		dd = A day with 2 digits
- 		
- 	...and any other Strings inbetween. Representing $y, $m and $d is done using
- 	\y, \m and \d and slash itself with \\. Simple example patterns:
- 
- 		'yyyy-mm-dd'
- 		'yyyymmdd'
- 		'yy.mm.dd'
- 		'y-m-d'
- 
- 	A year given using only two decimals is considered to be >2000."
- 
- 	| day month year patternStream char |
- 	patternStream := pattern readStream.
- 	[patternStream atEnd] whileFalse: [
- 		inputStream atEnd ifTrue: [^nil].
- 		char := patternStream next.
- 		char = $\
- 			ifTrue: [inputStream next = patternStream next ifFalse: [^nil]]
- 			ifFalse: [
- 				char = $y
- 					ifTrue: [
- 						(patternStream nextMatchAll: 'yyy')
- 							ifTrue: [year := (inputStream next: 4) asInteger]
- 							ifFalse: [
- 								(patternStream peekFor: $y)
- 									ifTrue: [
- 										year := (inputStream next: 2) asInteger]
- 									ifFalse: [
- 										year := Integer readFrom: inputStream]]]
- 					ifFalse: [
- 						char = $m
- 							ifTrue: [
- 								(patternStream peekFor: $m)
- 									ifTrue: [
- 										month := (inputStream next: 2) asInteger]
- 									ifFalse: [
- 										month := Integer readFrom: inputStream]]
- 							ifFalse: [
- 								char = $d
- 									ifTrue: [
- 										(patternStream peekFor: $d)
- 											ifTrue: [
- 												day := (inputStream next: 2) asInteger]
- 											ifFalse: [
- 												day := Integer readFrom: inputStream]]
- 									ifFalse: [
- 										inputStream next = char ifFalse: [^nil]]]]]].
- 	(year isNil | month isNil | day isNil) ifTrue: [^nil].
- 	^self year: year month: month day: day!

Item was removed:
- ----- Method: Date class>>readYearMonthDayFrom: (in category 'squeak protocol') -----
- readYearMonthDayFrom: aStream 
- 	"Read Date information from the stream in any of the forms:  
- 		<day> <month> <year>		(15 April 1982; 15-APR-82; 15.4.82; 15APR82)  
- 		<month> <day> <year>		(April 15, 1982; 4/15/82)
- 		<year>-<month>-<day>			(1982-04-15) (ISO8601)"
- 	| day month year parsedNumber prefix monthIndex |
- 	aStream peek = $-
- 		ifTrue: [prefix := -1]
- 		ifFalse: [prefix := 1].
- 	[aStream peek isAlphaNumeric]
- 		whileFalse: [aStream skip: 1].
- 	aStream peek isDigit
- 		ifTrue: [
- 			parsedNumber := (Integer readFrom: aStream) * prefix.
- 			(parsedNumber < 0 or: [parsedNumber > 31])
- 				ifTrue: [year := parsedNumber]].
- 	[aStream peek isAlphaNumeric]
- 		whileFalse: [aStream skip: 1].
- 	aStream peek isLetter
- 		ifTrue: ["MM-DD-YY or DD-MM-YY or YY-MM-DD"
- 			month := WriteStream on: (String new: 10).
- 			[aStream peek isLetter]
- 				whileTrue: [month nextPut: aStream next].
- 			month := month contents.
- 			[aStream peek isAlphaNumeric]
- 				whileFalse: [aStream skip: 1].
- 			parsedNumber isNil
- 				ifTrue: ["MM DD YY"
- 					day := Integer readFrom: aStream]
- 				ifFalse: [
- 					year isNil
- 						ifTrue: ["DD MM YY"
- 							day := parsedNumber]]]
- 		ifFalse: ["MM-DD-YY or DD-MM-YY or YY-MM-DD"
- 			year isNil 
- 				ifTrue: ["MM-DD-YY or DD-MM-YY"
- 					parsedNumber > 12
- 						ifTrue: ["DD-MM-YY"
- 							day := parsedNumber.
- 							monthIndex := Integer readFrom: aStream.
- 							"month := Month nameOfMonth: (Integer readFrom: aStream)"]
- 						ifFalse: ["MM-DD-YY"
- 							monthIndex := parsedNumber.
- 							"month := Month nameOfMonth: parsedNumber."
- 							day := Integer readFrom: aStream]]
- 				ifFalse: ["YY-MM-DD"
- 					monthIndex := Integer readFrom: aStream.
- 					"month := Month nameOfMonth: (Integer readFrom: aStream)"]].
- 	[aStream peek isAlphaNumeric]
- 		whileFalse: [aStream skip: 1].
- 	year isNil
- 		ifTrue: [year := Integer readFrom: aStream]
- 		ifFalse: [day := Integer readFrom: aStream].
- 	(year < 100 and: [year >= 0]) 
- 		ifTrue: [
- 			year < 69 
- 				ifTrue: [	year := 2000 + year]
- 				ifFalse: [year := 1900 + year]].
- 
- 	monthIndex ifNil: [monthIndex := Month indexOfMonth: month].
- 	^ { year . monthIndex . day }
- !

Item was removed:
- ----- Method: Date class>>starting: (in category 'squeak protocol') -----
- starting: aDateAndTime 
- 	^ self
- 		starting: aDateAndTime midnight
- 		duration: Duration oneDay!

Item was removed:
- ----- Method: Date class>>today (in category 'smalltalk-80') -----
- today
- 
- 	^ self current
- !

Item was removed:
- ----- Method: Date class>>tomorrow (in category 'squeak protocol') -----
- tomorrow
- 
- 	^ self today next!

Item was removed:
- ----- Method: Date class>>year:day: (in category 'squeak protocol') -----
- year: year day: dayOfYear 
- 	^ self starting:
- 		(DateAndTime
- 			year: year
- 			day: dayOfYear
- 			hour: 0
- 			minute: 0
- 			second: 0
- 			offset: self defaultOffset)!

Item was removed:
- ----- Method: Date class>>year:month:day: (in category 'squeak protocol') -----
- year: year month: month day: day 
- 	^ self starting:
- 		(DateAndTime
- 			year: year
- 			month: month
- 			day: day
- 			hour: 0
- 			minute: 0
- 			second: 0
- 			offset: self defaultOffset)!

Item was removed:
- ----- Method: Date class>>yesterday (in category 'squeak protocol') -----
- yesterday
- 
- 	^ self today previous!

Item was removed:
- ----- Method: Date>>@ (in category 'squeak protocol') -----
- @ aTime 
- 	^ DateAndTime
- 		date: self
- 		time: aTime!

Item was removed:
- ----- Method: Date>>addDays: (in category 'smalltalk-80') -----
- addDays: dayCount 
- 
- 	^ (self asDateAndTime + (dayCount days)) asDate!

Item was removed:
- ----- Method: Date>>addMonths: (in category 'utils') -----
- addMonths: monthCount 
- 	|year month maxDaysInMonth day |
- 	year := self year + (monthCount + self monthIndex - 1 // 12).
- 	month := self monthIndex + monthCount - 1 \\ 12 + 1.
- 	maxDaysInMonth := Month daysInMonth: month forYear: year.
- 	day := self dayOfMonth > maxDaysInMonth
- 				ifTrue: [maxDaysInMonth]
- 				ifFalse: [self dayOfMonth].
- 	^ Date
- 		newDay: day
- 		month: month
- 		year: year!

Item was removed:
- ----- Method: Date>>asDate (in category 'squeak protocol') -----
- asDate
- 
- 	^ self
- !

Item was removed:
- ----- Method: Date>>asSeconds (in category 'smalltalk-80') -----
- asSeconds
- 	"Answer the seconds since the Squeak epoch: 1 January 1901"
- 
- 	^ start asSeconds
- !

Item was removed:
- ----- Method: Date>>dayMonthYearDo: (in category 'squeak protocol') -----
- dayMonthYearDo: aBlock 
- 	"Supply integers for day, month and year to aBlock and return the result"
- 
- 	^ start dayMonthYearDo: aBlock!

Item was removed:
- ----- Method: Date>>leap (in category 'smalltalk-80') -----
- leap
- 	"Answer whether the receiver's year is a leap year."
- 
- 	^ start isLeapYear ifTrue: [1] ifFalse: [0].!

Item was removed:
- ----- Method: Date>>mmddyyyy (in category 'printing') -----
- mmddyyyy
- 	"Answer the receiver rendered in standard U.S.A format mm/dd/yyyy.
- 	Note that the name here is slightly misleading -- the month and day numbers don't show leading zeros, 
- 	so that for example February 1 1996 is 2/1/96"
- 
- 
- 	^ self printFormat: #(2 1 3 $/ 1 1)
- !

Item was removed:
- ----- Method: Date>>month (in category 'squeak protocol') -----
- month
- 	^ self asMonth!

Item was removed:
- ----- Method: Date>>monthIndex (in category 'squeak protocol') -----
- monthIndex
- 	^ super month!

Item was removed:
- ----- Method: Date>>onNextMonth (in category 'utils') -----
- onNextMonth
- 
- 	^ self addMonths: 1
- !

Item was removed:
- ----- Method: Date>>onPreviousMonth (in category 'utils') -----
- onPreviousMonth
- 
- 	^ self addMonths: -1
- !

Item was removed:
- ----- Method: Date>>previous: (in category 'smalltalk-80') -----
- previous: dayName 
- 	"Answer the previous date whose weekday name is dayName."
- 
- 	| days |
- 	days := 7 + self weekdayIndex - (self class dayOfWeek: dayName) \\ 7.
- 	days = 0 ifTrue: [ days := 7 ].
- 	^ self subtractDays: days!

Item was removed:
- ----- Method: Date>>printFormat: (in category 'printing') -----
- printFormat: formatArray 
- 	"Answer a String describing the receiver using the argument formatArray."
- 
- 	^String new: 17 streamContents: [ :stream |
- 		self printOn: stream format: formatArray ]!

Item was removed:
- ----- Method: Date>>printOn: (in category 'printing') -----
- printOn: aStream
- 
- 	self printOn: aStream format: #(1 2 3 $  3 1 )
- !

Item was removed:
- ----- Method: Date>>printOn:format: (in category 'printing') -----
- printOn: aStream format: formatArray 
- 	"Print a description of the receiver on aStream using the format 
- 	denoted the argument, formatArray: 
- 	
- 		#(item item item sep monthfmt yearfmt twoDigits) 
- 	
- 		items: 1=day 2=month 3=year will appear in the order given, 
- 	
- 		separated by sep which is eaither an ascii code or character. 
- 	
- 		monthFmt: 1=09 2=Sep 3=September 
- 	
- 		yearFmt: 1=1996 2=96 
- 	
- 		digits: (missing or)1=9 2=09. 
- 	
- 	See the examples in printOn: and mmddyy"
- 	| gregorian twoDigits element monthFormat |
- 	gregorian := self dayMonthYearDo: [ :d :m :y | {d. m. y} ].
- 	twoDigits := formatArray size > 6 and: [(formatArray at: 7) > 1].
- 	1 to: 3 do: 
- 		[ :i | 
- 			element := formatArray at: i.
- 			element = 1
- 				ifTrue: [twoDigits
- 						ifTrue: [aStream
- 								nextPutAll: (gregorian first asString
- 										padded: #left
- 										to: 2
- 										with: $0)]
- 						ifFalse: [gregorian first printOn: aStream]].
- 			element = 2
- 				ifTrue: [monthFormat := formatArray at: 5.
- 					monthFormat = 1
- 						ifTrue: [twoDigits
- 								ifTrue: [aStream
- 										nextPutAll: (gregorian middle asString
- 												padded: #left
- 												to: 2
- 												with: $0)]
- 								ifFalse: [gregorian middle printOn: aStream]].
- 					monthFormat = 2
- 						ifTrue: [aStream
- 								nextPutAll: ((Month nameOfMonth: gregorian middle)
- 										copyFrom: 1
- 										to: 3)].
- 					monthFormat = 3
- 						ifTrue: [aStream
- 								nextPutAll: (Month nameOfMonth: gregorian middle)]].
- 			element = 3
- 				ifTrue: [(formatArray at: 6)
- 							= 1
- 						ifTrue: [gregorian last printOn: aStream]
- 						ifFalse: [aStream
- 								nextPutAll: ((gregorian last \\ 100) asString
- 										padded: #left
- 										to: 2
- 										with: $0)]].
- 			i < 3
- 				ifTrue: [(formatArray at: 4)
- 							~= 0
- 						ifTrue: [aStream nextPut: (formatArray at: 4) asCharacter]]]!

Item was removed:
- ----- Method: Date>>storeOn: (in category 'printing') -----
- storeOn: aStream
- 
- 	aStream print: self printString; nextPutAll: ' asDate'
- !

Item was removed:
- ----- Method: Date>>subtractDate: (in category 'smalltalk-80') -----
- subtractDate: aDate 
- 	"Answer the number of days between self and aDate"
- 
- 	^ (self start - aDate asDateAndTime) days!

Item was removed:
- ----- Method: Date>>subtractDays: (in category 'smalltalk-80') -----
- subtractDays: dayCount 
- 
- 	^ (self asDateAndTime - (dayCount days)) asDate!

Item was removed:
- ----- Method: Date>>weekday (in category 'smalltalk-80') -----
- weekday
- 	"Answer the name of the day of the week on which the receiver falls."
- 
- 	^ self dayOfWeekName!

Item was removed:
- ----- Method: Date>>weekdayIndex (in category 'smalltalk-80') -----
- weekdayIndex
- 	"Sunday=1, ... , Saturday=7"
- 
- 	^ self dayOfWeek!

Item was removed:
- ----- Method: Date>>yyyymmdd (in category 'printing') -----
- yyyymmdd
- 	"Format the date in ISO 8601 standard like '2002-10-22'."
- 
- 	^ self printFormat: #(3 2 1 $- 1 1 2)
- !

Item was removed:
- Magnitude subclass: #DateAndTime
- 	instanceVariableNames: 'utcMicroseconds localOffsetSeconds'
- 	classVariableNames: 'AutomaticTimezone ClockProvider LocalTimeZone PosixEpochJulianDays'
- 	poolDictionaries: 'ChronologyConstants'
- 	category: 'Chronology-Core'!
- 
- !DateAndTime commentStamp: 'dtl 3/12/2016 10:32' prior: 0!
- I represent a point in UTC time as defined by ISO 8601. I have zero duration.
- 
- My implementation uses variables utcMicroseconds and localOffsetSeconds. This represents time magnitude as elapsed microseconds since the Posix epoch, with localOffsetSeconds representing local offset from UTC. The magnitude is used for comparison and duration calculations, and the local offset is used for displaying this magnitude in the context of a local time zone.
- 
- The implementation ignores leap seconds, which are adjustments made to maintain earth rotational clock time in synchronization with elapsed seconds.
- 
- DateAndTime class>>now will use #primitiveUtcWithOffset to obtain current time in UTC microseconds with current local offset in seconds. The primitive provides an atomic query for UTC time and local offset as measured by the OS platform.  If primitiveUtcWithOffset is not available, the traditional implementation is used, which relies on a primitive for microseconds in the local time zone and derives UTC based on the TimeZone setting.
- !

Item was removed:
- ----- Method: DateAndTime class>>automaticTimezone (in category 'preferences') -----
- automaticTimezone
- 	"Accessor for the system-wide preference"
- 	
- 	<preference: 'Automatically set local timezone'
- 		category: 'general'
- 		description: 'If enabled, the timezone will automatically be kept in sync with the system''s time (daylight savings changes etc.)'
- 		type: #Boolean>
- 	^AutomaticTimezone ifNil: [ true ]!

Item was removed:
- ----- Method: DateAndTime class>>automaticTimezone: (in category 'preferences') -----
- automaticTimezone: aBooleanOrNil
- 	"Accessor for the system-wide preference.
- 	Note this gets disabled in localTimeZone: to make that override stick"
- 	
- 	AutomaticTimezone := aBooleanOrNil.
- 	self automaticTimezone ifTrue: [self now].		"fetch timezone immediately"!

Item was removed:
- ----- Method: DateAndTime class>>clock (in category 'clock provider') -----
- clock 
- 	 "the provider of real time seconds/milliseconds."
- 
- 	^ ClockProvider !

Item was removed:
- ----- Method: DateAndTime class>>clockPrecision (in category 'ansi protocol') -----
- clockPrecision
- 	"One nanosecond precision"
- 
- 	^ Duration seconds: 0 nanoSeconds: 1
- !

Item was removed:
- ----- Method: DateAndTime class>>current (in category 'squeak protocol') -----
- current
- 
- 
- 	^ self now!

Item was removed:
- ----- Method: DateAndTime class>>date:time: (in category 'squeak protocol') -----
- date: aDate time: aTime
- 
- 	^ self 
- 		year: aDate year
- 		month: aDate monthIndex
- 		day: aDate dayOfMonth 
- 		hour: aTime hour 
- 		minute: aTime minute
- 		second: aTime second
- 		nanoSecond: aTime nanoSecond
- 		offset: aDate start offset!

Item was removed:
- ----- Method: DateAndTime class>>daysFromSmalltalkEpochToPosixEpoch (in category 'private') -----
- daysFromSmalltalkEpochToPosixEpoch
- 
- 	^52 * 365 + (17 * 366)!

Item was removed:
- ----- Method: DateAndTime class>>epoch (in category 'squeak protocol') -----
- epoch
- 	"Answer a DateAndTime representing the Squeak epoch: 1 January 1901"
- 
- 	^ self utcMicroseconds: self epochOffsetMicros negated offset: 0
- !

Item was removed:
- ----- Method: DateAndTime class>>epochOffset (in category 'private') -----
- epochOffset
- 	"Elaspsed seconds from the Smalltalk epoch to the Posix epoch"
- 	^self daysFromSmalltalkEpochToPosixEpoch * SecondsInDay!

Item was removed:
- ----- Method: DateAndTime class>>epochOffsetMicros (in category 'private') -----
- epochOffsetMicros
- 	"Elaspsed microseconds from the Smalltalk epoch to the Posix epoch"
- 	^self epochOffset * 1000000!

Item was removed:
- ----- Method: DateAndTime class>>fromSeconds: (in category 'smalltalk-80') -----
- fromSeconds: seconds 
- 	"Answer a DateAndTime since the Squeak epoch: 1 January 1901
- 
- 	Squeak traditionally used seconds since the Smalltalk epoch in local time,
- 	which is undefinable. The error was probably caused by some early VM design
- 	choices that have since been corrected. Assume now that the Smalltalk epoch
- 	is defined relative to GMT, and that it may be treated similarly to the Posix
- 	epoch except for a constant offset value.
- 
- 	This implementation differs from earlier Squeak in that it uses seconds relative
- 	to the Smalltalk epoch (not local time), and represents seconds as an arbitrary
- 	precision number rather than an integer."
- 
- 	| s uSec offset |
- 	offset := self localOffsetSeconds.
- 	s := seconds - self epochOffset.
- 	uSec := s * 1000000.
- 	^ self utcMicroseconds: uSec offset: offset
- !

Item was removed:
- ----- Method: DateAndTime class>>fromString: (in category 'squeak protocol') -----
- fromString: aString
- 
- 
- 	^ self readFrom: (ReadStream on: aString)!

Item was removed:
- ----- Method: DateAndTime class>>fromUnixTime: (in category 'squeak protocol') -----
- fromUnixTime: utcSeconds
- 
- 	^self utcSeconds: utcSeconds offset: 0
- !

Item was removed:
- ----- Method: DateAndTime class>>initialize (in category 'initialize-release') -----
- initialize
- 
- 	ClockProvider := Time.
- 	PosixEpochJulianDays := 2440588.!

Item was removed:
- ----- Method: DateAndTime class>>julianDayNumber: (in category 'squeak protocol') -----
- julianDayNumber: anInteger 
- 	^ self
- 		julianDayNumber: anInteger
- 		offset: self localOffset!

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

Item was removed:
- ----- Method: DateAndTime class>>localOffset (in category 'squeak protocol') -----
- localOffset
- 	"Answer the duration we are offset from UTC"
- 
- 	^ Duration seconds: self localOffsetSeconds
- !

Item was removed:
- ----- Method: DateAndTime class>>localOffset: (in category 'squeak protocol') -----
- localOffset: aDuration
- 	"Override the local time zone (for testing). This disables the #automaticTimezone: preference"
- 	self localTimeZone: (TimeZone offset: aDuration name: 'Local Time (override)' abbreviation: 'LTO').
- !

Item was removed:
- ----- Method: DateAndTime class>>localOffsetSeconds (in category 'private') -----
- localOffsetSeconds
- 
- 	self automaticTimezone
- 		ifTrue: [ ^Time posixMicrosecondClockWithOffset second ]
- 		ifFalse: [ ^self localTimeZone offset asSeconds ]!

Item was removed:
- ----- Method: DateAndTime class>>localTimeZone (in category 'accessing') -----
- localTimeZone
- 	"Answer the local time zone"
- 
- 	^ LocalTimeZone ifNil: [ LocalTimeZone := TimeZone default ]
- 
- !

Item was removed:
- ----- Method: DateAndTime class>>localTimeZone: (in category 'accessing') -----
- localTimeZone: aTimeZone
- 	"Set the local time zone"
- 	"
- 	DateAndTime localTimeZone: (TimeZone offset:  0 hours name: 'Universal Time' abbreviation: 'UTC').
- 	DateAndTime localTimeZone: (TimeZone offset: -8 hours name: 'Pacific Standard Time' abbreviation: 'PST').
- 	"
- 	LocalTimeZone := aTimeZone.
- 	self automaticTimezone: (aTimeZone abbreviation = 'LT')!

Item was removed:
- ----- Method: DateAndTime class>>midnight (in category 'squeak protocol') -----
- midnight
- 
- 	^ self now midnight!

Item was removed:
- ----- Method: DateAndTime class>>milliSecondsSinceMidnight (in category 'squeak protocol') -----
- milliSecondsSinceMidnight
- 	^Time milliSecondsSinceMidnight!

Item was removed:
- ----- Method: DateAndTime class>>millisecondClock (in category 'smalltalk-80') -----
- millisecondClock
- 
- 	^self clock millisecondClock!

Item was removed:
- ----- Method: DateAndTime class>>new (in category 'squeak protocol') -----
- new
- 	"Answer a DateAndTime representing the Squeak epoch: 1 January 1901"
- 
- 	^ self utcMicroseconds: self epochOffsetMicros negated offset: 0
- 
- !

Item was removed:
- ----- Method: DateAndTime class>>noon (in category 'squeak protocol') -----
- noon
- 
- 	^ self now noon
- !

Item was removed:
- ----- Method: DateAndTime class>>now (in category 'ansi protocol') -----
- now
- 	"Answer time now as reported by #primitiveUtcWithOffset. If the primitive is not
- 	available, answer the Posix epoch GMT."
- 
- 	self automaticTimezone
- 		ifTrue: [ ^ self basicNew initializeFromPrimitive ]
- 		ifFalse: [ | timeArray |
- 			timeArray := Time posixMicrosecondClockWithOffset.
- 			^ self utcMicroseconds: timeArray first offset: self localOffsetSeconds ]
- !

Item was removed:
- ----- Method: DateAndTime class>>nowAtOffset: (in category 'squeak protocol') -----
- nowAtOffset: offsetDuration
- 	"Answers the local time at places with the specified offsetDuration timezone."
- 	"local time Chicago (CST)"
- 	"DateAndTime nowAtOffset: -6 hours"
- 
- 	^ self utcMicroseconds: Time posixMicrosecondClockWithOffset first offset: offsetDuration asSeconds
- !

Item was removed:
- ----- Method: DateAndTime class>>readFrom: (in category 'squeak protocol') -----
- readFrom: aStream
- 
- 	| yearMonthDay hourMinuteSecondNano offsetSeconds |
- 
- 	yearMonthDay := Date readYearMonthDayFrom: aStream.
- 	[aStream peek isDigit]
- 		whileFalse: [aStream next].
- 	hourMinuteSecondNano := Time readHourMinuteSecondNanoFrom: aStream.
- 	(aStream atEnd or: [('+-Z' includes: aStream peek) not])
- 		ifTrue: [ self flag: #FIXME.
- 				"Different unit tests have conflicting opinions as to whether the
- 				current local offset should be used as a default. However, the current
- 				local offset cannot be correct due to DST (offset is itself a function
- 				of the point in time). Nevertheless, this is a reasonable default considering
- 				that the offset would have been explicitly part of the date string if it
- 				was a matter of concern. Unit tests will require updates to match this
- 				assumption."
- 				"offsetSeconds := 0"
- 				offsetSeconds := self localOffsetSeconds]
- 		ifFalse: [(aStream peekFor: $Z)
- 			ifTrue: [offsetSeconds := 0]
- 			ifFalse: [ | ch offsetString offset |
- 				ch := aStream next.
- 				ch = $+ ifTrue: [ch := Character space].
- 				offsetString := aStream upToEnd.
- 				(offsetString atLast: 3 ifAbsent: ['']) = $:
- 					ifFalse: [offsetString := (offsetString allButLast: 2) , ':' , (offsetString last: 2)].
- 				offset := Duration fromString: ch asString, '0:', offsetString, ':0'.
- 				offsetSeconds := offset asSeconds]].
- 	^ self
- 		year: yearMonthDay first
- 		month: yearMonthDay second
- 		day: yearMonthDay third
- 		hour: hourMinuteSecondNano first
- 		minute: hourMinuteSecondNano second
- 		second: hourMinuteSecondNano third
- 		nanoSecond: hourMinuteSecondNano fourth
- 		offsetSeconds: offsetSeconds
- 
- 
- 	"	'-1199-01-05T20:33:14.321-05:00' asDateAndTime
- 		' 2002-05-16T17:20:45.1+01:01' asDateAndTime
- 
- 		' 2002-05-16T17:20:45.02+01:01' asDateAndTime
- 
- 		' 2002-05-16T17:20:45.003+01:01' asDateAndTime
- 
- 		' 2002-05-16T17:20:45.0004+01:01' asDateAndTime
-   		' 2002-05-16T17:20:45.00005' asDateAndTime
- 		' 2002-05-16T17:20:45.000006+01:01' asDateAndTime
- 
- 		' 2002-05-16T17:20:45.0000007+01:01' asDateAndTime
- 		' 2002-05-16T17:20:45.00000008-01:01' asDateAndTime   
- 		' 2002-05-16T17:20:45.000000009+01:01' asDateAndTime  
- 		' 2002-05-16T17:20:45.0000000001+01:01' asDateAndTime  
- 
-  		' 2002-05-16T17:20' asDateAndTime
- 		' 2002-05-16T17:20:45' asDateAndTime
- 		' 2002-05-16T17:20:45+01:57' asDateAndTime
-  		' 2002-05-16T17:20:45-02:34' asDateAndTime
-  		' 2002-05-16T17:20:45+00:00' asDateAndTime
- 		' 1997-04-26T01:02:03+01:02:3' asDateAndTime 
- 		
- 		' 1970-01-01T00:00:00.000+0000' asDateAndTime
-  	"!

Item was removed:
- ----- Method: DateAndTime class>>today (in category 'squeak protocol') -----
- today
- 
- 	^ self midnight!

Item was removed:
- ----- Method: DateAndTime class>>tomorrow (in category 'squeak protocol') -----
- tomorrow
- 
- 	^ self today asDate next asDateAndTime
- !

Item was removed:
- ----- Method: DateAndTime class>>unixEpoch (in category 'squeak protocol') -----
- unixEpoch
- 	"Answer a DateAndTime representing the Unix epoch (1 January 1970, midnight UTC)"
- 
- 	^self utcMicroseconds: 0 offset: 0!

Item was removed:
- ----- Method: DateAndTime class>>utcMicroseconds:offset: (in category 'instance creation') -----
- utcMicroseconds: microsecondsSincePosixEpoch offset: secondsFromGMT
- 
- 	^super new
- 		utcMicroseconds: microsecondsSincePosixEpoch
- 		offset: secondsFromGMT!

Item was removed:
- ----- Method: DateAndTime class>>utcMicrosecondsForYear:month:day:hour:minute:second:nanoSecond:offsetSeconds: (in category 'private') -----
- utcMicrosecondsForYear: year month: month day: day hour: hour minute: minute second: second nanoSecond: nanoCount  offsetSeconds: offsetSeconds
- 
- 	| monthIndex daysInMonth p q r s julianDayNumber posixDays seconds utcSeconds |
- 
- 	monthIndex := month isInteger ifTrue: [month] ifFalse: [Month indexOfMonth: month].
- 	daysInMonth := Month
- 		daysInMonth: monthIndex
- 		forYear: year.
- 	day < 1 ifTrue: [self error: 'day may not be zero or negative'].
- 	day > daysInMonth ifTrue: [self error: 'day is after month ends']. 	
- 	
- 	p := (monthIndex - 14) quo: 12.
- 	q := year + 4800 + p.
- 	r := monthIndex - 2 - (12 * p).
- 	s := (year + 4900 + p) quo: 100.
- 
- 	julianDayNumber :=
-  		( (1461 * q) quo: 4 ) +
- 			( (367 * r) quo: 12 ) -
-  				( (3 * s) quo: 4 ) +
-  					( day - 32075 ).
- 
- 	posixDays := julianDayNumber - PosixEpochJulianDays.
- 	seconds := hour * 60 + minute * 60 + second - offsetSeconds.
- 	utcSeconds := seconds + (posixDays * 24 * 3600).
- 	^ utcSeconds * 1000000 + (nanoCount / 1000)
- !

Item was removed:
- ----- Method: DateAndTime class>>utcSeconds:offset: (in category 'instance creation') -----
- utcSeconds: secondsSincePosixEpoch offset: secondsFromGMT
- 
- 	^self
- 		utcMicroseconds: secondsSincePosixEpoch * 1000000
- 		offset: secondsFromGMT!

Item was removed:
- ----- Method: DateAndTime class>>year:day: (in category 'squeak protocol') -----
- year: year day: dayOfYear
- 	"Return a DateAndTime"
- 
- 	^ self
- 		year: year
- 		day: dayOfYear
- 		hour: 0
- 		minute: 0
- 		second: 0
- !

Item was removed:
- ----- Method: DateAndTime class>>year:day:hour:minute:second: (in category 'ansi protocol') -----
- year: year day: dayOfYear hour: hour minute: minute second: second
- 
- 	^ self
- 		year: year
- 		day: dayOfYear
- 		hour: hour
- 		minute: minute
- 		second: second
- 		offset: self localOffset
- !

Item was removed:
- ----- Method: DateAndTime class>>year:day:hour:minute:second:offset: (in category 'ansi protocol') -----
- year: year day: dayOfYear hour: hour minute: minute second: second offset: offset 
- 	"Return a DataAndTime"
- 
- 	| y d |
- 	y := self
- 		year: year
- 		month: 1
- 		day: 1
- 		hour: hour
- 		minute: minute
- 		second: second
- 		nanoSecond: 0
- 		offset: offset.
- 
- 	d := Duration days: (dayOfYear - 1).
- 
- 	^ y + d
- !

Item was removed:
- ----- Method: DateAndTime class>>year:month:day: (in category 'squeak protocol') -----
- year: year month: month day: day
- 	"Return a DateAndTime, midnight local time"
- 	
- 	^self
-  		year: year
-  		month: month
-  		day: day
-  		hour: 0
- 		minute: 0
- !

Item was removed:
- ----- Method: DateAndTime class>>year:month:day:hour:minute: (in category 'squeak protocol') -----
- year: year month: month day: day hour: hour minute: minute
- 	"Return a DateAndTime"
- 
- 	^self
-  		year: year
-  		month: month
-  		day: day
-  		hour: hour
- 		minute: minute
- 		second: 0
- !

Item was removed:
- ----- Method: DateAndTime class>>year:month:day:hour:minute:second: (in category 'ansi protocol') -----
- year: year month: month day: day hour: hour minute: minute second: second
- 	"Return a DateAndTime"
- 
- 	^ self
- 		year: year
- 		month: month
- 		day: day
- 		hour: hour
- 		minute: minute
- 		second: second
- 		offset: self localOffset!

Item was removed:
- ----- Method: DateAndTime 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"
- 
- 	| offsetSeconds utcMicros |
- 	offsetSeconds := offset asSeconds.
- 	utcMicros := self
- 				utcMicrosecondsForYear: year
- 				month: month
- 				day: day
- 				hour: hour
- 				minute: minute
- 				second: second
- 				nanoSecond: nanoCount
- 				offsetSeconds: offsetSeconds.
- 	^ self utcMicroseconds: utcMicros offset: offsetSeconds!

Item was removed:
- ----- Method: DateAndTime class>>year:month:day:hour:minute:second:nanoSecond:offsetSeconds: (in category 'squeak protocol') -----
- year: year month: month day: day hour: hour minute: minute second: second nanoSecond: nanoCount offsetSeconds: offsetSeconds
- 	"Return a DateAndTime"
- 
- 	| utcMicros |
- 	utcMicros := self
- 				utcMicrosecondsForYear: year
- 				month: month
- 				day: day
- 				hour: hour
- 				minute: minute
- 				second: second
- 				nanoSecond: nanoCount
- 				offsetSeconds: offsetSeconds.
- 	^ self utcMicroseconds: utcMicros offset: offsetSeconds!

Item was removed:
- ----- Method: DateAndTime class>>year:month:day:hour:minute:second:offset: (in category 'ansi protocol') -----
- year: year month: month day: day hour: hour minute: minute second: second offset: offset
- 
- 	^ self
- 		year: year
- 		month: month
- 		day: day
- 		hour: hour
- 		minute: minute
- 		second: second
- 		nanoSecond: 0
- 		offset: offset!

Item was removed:
- ----- Method: DateAndTime class>>yesterday (in category 'squeak protocol') -----
- yesterday
- 
- 	^ self today asDate previous asDateAndTime!

Item was removed:
- ----- Method: DateAndTime>>+ (in category 'ansi protocol') -----
- + operand
- 	"operand conforms to protocol Duration"
- 
- 	^ self class
- 		utcMicroseconds: operand asDuration asNanoSeconds / 1000 + utcMicroseconds
- 		offset: localOffsetSeconds
- !

Item was removed:
- ----- Method: DateAndTime>>- (in category 'ansi protocol') -----
- - operand
- 	"operand conforms to protocol DateAndTime or protocol Duration"
- 
- 	^ (operand respondsTo: #asDateAndTime)
- 		ifTrue: 
- 			[ | micros |
- 			micros := utcMicroseconds - operand asDateAndTime utcMicroseconds.
- 			Duration seconds: micros // 1000000 nanoSeconds: micros \\ 1000000 * 1000]
- 		ifFalse:
- 			[ self + (operand negated) ]
- !

Item was removed:
- ----- Method: DateAndTime>>< (in category 'ansi protocol') -----
- < comparand
- 	"comparand conforms to protocol DateAndTime,
- 	or can be converted into something that conforms."
- 
- 	^utcMicroseconds < comparand asDateAndTime utcMicroseconds
- !

Item was removed:
- ----- Method: DateAndTime>>= (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 utcMicroseconds ]!

Item was removed:
- ----- Method: DateAndTime>>asChronologySeconds (in category 'converting') -----
- asChronologySeconds
- 	"What #asSeconds answers in prior Chronology-format images."
- 	^ self asSeconds + self offset asSeconds!

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

Item was removed:
- ----- Method: DateAndTime>>asDateAndTime (in category 'squeak protocol') -----
- asDateAndTime
- 
- 	^ self!

Item was removed:
- ----- Method: DateAndTime>>asDuration (in category 'squeak protocol') -----
- asDuration
- 	"Answer the duration since midnight."
- 
- 	^ Duration seconds: self getSeconds nanoSeconds: self nanoSecond
- !

Item was removed:
- ----- Method: DateAndTime>>asExactSeconds (in category 'smalltalk-80') -----
- asExactSeconds
- 	"Return the duration in seconds since the Squeak epoch"
- 
- 	"Squeak traditionally used seconds since the Smalltalk epoch in local time,
- 	which is undefinable. The error was probably caused by some early VM design
- 	choices that have since been corrected. Assume now that the Smalltalk epoch
- 	is defined relative to GMT, and that it may be treated similarly to the Posix
- 	epoch except for a constant offset value.
- 
- 	This implementation differs from earlier Squeak in that it uses seconds relative
- 	to the Smalltalk epoch (not local time), and represents seconds as an arbitrary
- 	precision number rather than an integer."
- 
- 	^ utcMicroseconds / 1000000 + self class epochOffset
- !

Item was removed:
- ----- Method: DateAndTime>>asLocal (in category 'ansi protocol') -----
- asLocal
- 	
- 
- 	^ (self offset = self class localOffset)
- 
- 		ifTrue: [self]
- 		ifFalse: [self utcOffset: self class localOffset]!

Item was removed:
- ----- Method: DateAndTime>>asMonth (in category 'squeak protocol') -----
- asMonth
- 
- 	^ Month starting: self!

Item was removed:
- ----- Method: DateAndTime>>asNanoSeconds (in category 'squeak protocol') -----
- asNanoSeconds
- 	"Answer the number of nanoseconds since midnight"
- 
- 	^ self asDuration asNanoSeconds!

Item was removed:
- ----- Method: DateAndTime>>asPosixSeconds (in category 'converting') -----
- asPosixSeconds
- 
- 	^utcMicroseconds / 1000000
- !

Item was removed:
- ----- Method: DateAndTime>>asSeconds (in category 'smalltalk-80') -----
- asSeconds
- 	"Return the number of seconds since the Squeak epoch. See asExactSeconds
- 	to retain full precision of the duration in seconds."
- 
- 	"Squeak traditionally used seconds since the Smalltalk epoch in local time,
- 	which is undefinable. The error was probably caused by some early VM design
- 	choices that have since been corrected. Assume now that the Smalltalk epoch
- 	is defined relative to GMT, and that it may be treated similarly to the Posix
- 	epoch except for a constant offset value.
- 
- 	This implementation differs from earlier Squeak in that it uses seconds relative
- 	to the Smalltalk epoch (not local time), and represents seconds as an arbitrary
- 	precision number rather than an integer."
- 
- 	^ utcMicroseconds // 1000000 + self class epochOffset
- !

Item was removed:
- ----- Method: DateAndTime>>asTime (in category 'squeak protocol') -----
- asTime
- 
- 
- 	^ Time seconds: self getSeconds nanoSeconds: self nanoSecond
- !

Item was removed:
- ----- Method: DateAndTime>>asTimeStamp (in category 'squeak protocol') -----
- asTimeStamp
- 
- 	^ self as: TimeStamp!

Item was removed:
- ----- Method: DateAndTime>>asUTC (in category 'ansi protocol') -----
- asUTC
- 
- 	localOffsetSeconds = 0 ifTrue: [ ^self ].
- 	^self copy localOffsetSeconds: 0.!

Item was removed:
- ----- Method: DateAndTime>>asUnixTime (in category 'squeak protocol') -----
- asUnixTime
- 	"answer number of seconds since unix epoch (midnight Jan 1, 1970, UTC)"
- 
- 	^utcMicroseconds // 1000000!

Item was removed:
- ----- Method: DateAndTime>>asWeek (in category 'squeak protocol') -----
- asWeek
- 
- 	^ Week starting: self!

Item was removed:
- ----- Method: DateAndTime>>asYear (in category 'squeak protocol') -----
- asYear
- 
- 	^ Year starting: self!

Item was removed:
- ----- Method: DateAndTime>>day (in category 'smalltalk-80') -----
- day
- 
- 	^ self dayOfYear
- !

Item was removed:
- ----- Method: DateAndTime>>dayMonthYearDo: (in category 'squeak protocol') -----
- dayMonthYearDo: aBlock
- 	"Evaluation the block with three arguments: day month, year."
- 
- 	| l n i j dd |
- 	l := self julianDayNumber + 68569.
- 	n := 4 * l // 146097.
- 	l := l - (146097 * n + 3 // 4).
- 	i := l + 1 * 4000 // 1461001.
- 	l := l - (1461 * i // 4) + 31.
- 	j := 80 * l // 2447.
- 	dd := l - (2447 * j // 80).
- 	l := j // 11.
- 
- 	^ aBlock
- 		value: dd
- 		value: -12 * l + 2 + j "month"
- 		value: n - 49 * 100 + i + l "year"!

Item was removed:
- ----- Method: DateAndTime>>dayOfLocalWeek (in category 'ansi protocol') -----
- dayOfLocalWeek
- 
- 	"Sunday=1, ... , Saturday=7"
- 
- 	^ (self julianDayNumber + 2 - Week weekdayStartIndex rem: 7) + 1
- !

Item was removed:
- ----- Method: DateAndTime>>dayOfMonth (in category 'ansi protocol') -----
- dayOfMonth
- 	"Answer which day of the month is represented by the receiver."
- 
- 	^ self
- 		dayMonthYearDo: [ :d :m :y | d ]
- !

Item was removed:
- ----- Method: DateAndTime>>dayOfWeek (in category 'ansi protocol') -----
- dayOfWeek
- 
- 	"Sunday=1, ... , Saturday=7"
- 
- 	^ (self julianDayNumber + 1 rem: 7) + 1
- !

Item was removed:
- ----- Method: DateAndTime>>dayOfWeekAbbreviation (in category 'ansi protocol') -----
- dayOfWeekAbbreviation
- 
- 	^ self dayOfWeekName copyFrom: 1 to: 3
- !

Item was removed:
- ----- Method: DateAndTime>>dayOfWeekName (in category 'ansi protocol') -----
- dayOfWeekName
- 
- 	^ Week nameOfDay: self dayOfWeek!

Item was removed:
- ----- Method: DateAndTime>>dayOfYear (in category 'ansi protocol') -----
- dayOfYear
- 	"This code was contributed by Dan Ingalls. It is equivalent to the terser
- 		^ jdn - (Year year: self year) start julianDayNumber + 1 but much quicker."
- 
- 	^ self dayMonthYearDo:
- 		[ :d :m :y |
- 			| monthStart |
- 			monthStart := #(1 32 60 91 121 152 182 213 244 274 305 335) at: m.
- 			(m > 2 and: [ Year isLeapYear: y ])
- 				ifTrue: [ monthStart + d ]
- 				ifFalse: [ monthStart + d - 1 ]]!

Item was removed:
- ----- Method: DateAndTime>>daysInMonth (in category 'smalltalk-80') -----
- daysInMonth
- 	"Answer the number of days in the month represented by the receiver."
- 
- 
- 	^ self asMonth daysInMonth!

Item was removed:
- ----- Method: DateAndTime>>daysInYear (in category 'smalltalk-80') -----
- daysInYear
- 
- 	"Answer the number of days in the year represented by the receiver."
- 
- 	^ self asYear daysInYear!

Item was removed:
- ----- Method: DateAndTime>>daysLeftInYear (in category 'smalltalk-80') -----
- daysLeftInYear
- 	"Answer the number of days in the year after the date of the receiver."
- 
- 	^ self daysInYear - self dayOfYear!

Item was removed:
- ----- Method: DateAndTime>>duration (in category 'squeak protocol') -----
- duration
- 
- 	^ Duration zero!

Item was removed:
- ----- Method: DateAndTime>>firstDayOfMonth (in category 'smalltalk-80') -----
- firstDayOfMonth
- 
- 	^ self asMonth start day
- !

Item was removed:
- ----- Method: DateAndTime>>floor (in category 'squeak protocol') -----
- floor
- 	"Answer a copy with magnitude rounded down to the nearest whole second"
- 	^self class
- 		utcMicroseconds: utcMicroseconds // 1000000 * 1000000
- 		offset: localOffsetSeconds!

Item was removed:
- ----- Method: DateAndTime>>getSeconds (in category 'accessing') -----
- getSeconds
- 	
- 	^utcMicroseconds // 1000000 + localOffsetSeconds \\ 86400!

Item was removed:
- ----- Method: DateAndTime>>hash (in category 'ansi protocol') -----
- hash
- 	^utcMicroseconds hash!

Item was removed:
- ----- Method: DateAndTime>>hour (in category 'ansi protocol') -----
- hour
- 
- 	^ self hour24!

Item was removed:
- ----- Method: DateAndTime>>hour12 (in category 'ansi protocol') -----
- hour12
- 	"Answer an <integer> between 1 and 12, inclusive, representing the hour 
- 	of the day in the 12-hour clock of the local time of the receiver."
- 	^ self hour24 - 1 \\ 12 + 1
- !

Item was removed:
- ----- Method: DateAndTime>>hour24 (in category 'ansi protocol') -----
- hour24
- 
- 	^self getSeconds // 3600!

Item was removed:
- ----- Method: DateAndTime>>hours (in category 'smalltalk-80') -----
- hours
- 
- 	^ self hour
- !

Item was removed:
- ----- Method: DateAndTime>>initializeFromPrimitive (in category 'initialize-release') -----
- initializeFromPrimitive
- 
- 	Time posixMicrosecondClockWithOffset: self!

Item was removed:
- ----- Method: DateAndTime>>isLeapYear (in category 'ansi protocol') -----
- isLeapYear
- 
- 
- 	^ Year isLeapYear: self year
- !

Item was removed:
- ----- Method: DateAndTime>>julianDayNumber (in category 'squeak protocol') -----
- julianDayNumber
- 
- 	^utcMicroseconds // 1000000 + localOffsetSeconds // 86400 + PosixEpochJulianDays!

Item was removed:
- ----- Method: DateAndTime>>localOffsetSeconds: (in category 'initialize-release') -----
- localOffsetSeconds: seconds
- 	"Private. Allow value to be modified during initialization in order to support local
- 	timezone preference."
- 
- 	localOffsetSeconds := seconds
- !

Item was removed:
- ----- Method: DateAndTime>>makeUTC (in category 'squeak protocol') -----
- makeUTC
- 	"Make the receiver's timezone UTC. This adjusts both the magnitude and
- 	local offset of the receiver such that self asString remains unchanged
- 	except for a zero timezone offset."
- 
- 	^ self
- 		utcMicroseconds: localOffsetSeconds * 1000000 + utcMicroseconds
- 		offset: 0
- !

Item was removed:
- ----- Method: DateAndTime>>meridianAbbreviation (in category 'ansi protocol') -----
- meridianAbbreviation
- 
- 	^ self asTime meridianAbbreviation
- !

Item was removed:
- ----- Method: DateAndTime>>microsecondsFromDay:seconds:nanos:offset: (in category 'private') -----
- microsecondsFromDay: jdn seconds: s nanos: n offset: localOffsetSeconds
- 
- 	^jdn - PosixEpochJulianDays "days" * 86400
- 		+ s - localOffsetSeconds "seconds" * 1000000
- 		+ (n / 1000) "nanos"!

Item was removed:
- ----- Method: DateAndTime>>middleOf: (in category 'squeak protocol') -----
- middleOf: aDuration
- 	"Return a Timespan where the receiver is the middle of the Duration"
- 
- 	| duration |
- 	duration := aDuration asDuration.
- 
- 	^ Timespan starting: (self - (duration / 2)) duration: duration
- !

Item was removed:
- ----- Method: DateAndTime>>midnight (in category 'squeak protocol') -----
- midnight
- 	"Answer a DateAndTime starting at midnight of the same timezone offset as the receiver."
- 	^ self class basicNew
- 		setJdn: self julianDayNumber
- 		seconds: 0
- 		nano: 0
- 		localOffsetSeconds: localOffsetSeconds.!

Item was removed:
- ----- Method: DateAndTime>>minute (in category 'ansi protocol') -----
- minute
- 
- 	^self getSeconds // 60 \\ 60!

Item was removed:
- ----- Method: DateAndTime>>minutes (in category 'smalltalk-80') -----
- minutes
- 
- 	^ self minute
- !

Item was removed:
- ----- Method: DateAndTime>>month (in category 'ansi protocol') -----
- month
- 
- 	^ self 
- 		dayMonthYearDo: [ :d :m :y | m ]
- !

Item was removed:
- ----- Method: DateAndTime>>monthAbbreviation (in category 'ansi protocol') -----
- monthAbbreviation
- 
- 
- 	^ self monthName copyFrom: 1 to: 3!

Item was removed:
- ----- Method: DateAndTime>>monthIndex (in category 'smalltalk-80') -----
- monthIndex
- 
- 
- 	^ self month!

Item was removed:
- ----- Method: DateAndTime>>monthName (in category 'ansi protocol') -----
- monthName
- 
- 
- 	^ Month nameOfMonth: self month!

Item was removed:
- ----- Method: DateAndTime>>nanoSecond (in category 'squeak protocol') -----
- nanoSecond
- 
- 	^utcMicroseconds \\ 1000000 * 1000
- !

Item was removed:
- ----- Method: DateAndTime>>noon (in category 'squeak protocol') -----
- noon
- 	"Answer a DateAndTime starting at noon"
- 
- 	^ self dayMonthYearDo: 
- 		[ :d :m :y | self class year: y month: m day: d hour: 12 minute: 0 second: 0 ]
- !

Item was removed:
- ----- Method: DateAndTime>>normalize:ticks:base: (in category 'private') -----
- normalize: i ticks: ticks base: base
- 
- 	| tick div quo rem |
- 	tick := ticks at: i.
- 	div := tick asInteger digitDiv: base neg: tick negative.
- 	quo := (div at: 1) normalize.
- 	rem := (div at: 2) normalize.
- 	rem < 0 ifTrue: [ quo := quo - 1. rem := base + rem ].
- 	ticks at: (i-1) put: ((ticks at: i-1) + quo).
- 	ticks at: i put: rem
- !

Item was removed:
- ----- Method: DateAndTime>>offset (in category 'ansi protocol') -----
- offset
- 
- 	^ Duration seconds: localOffsetSeconds!

Item was removed:
- ----- Method: DateAndTime>>offset: (in category 'ansi protocol') -----
- offset: anOffset
- 	"Answer a DateAndTime for a different time zone offset that has the same
- 	year, month, day, hour, minute, and second as this instance, and with
- 	printString that matches except for time zone offset."
- 
- 	| newOffset newMicros |
- 	newOffset := anOffset asDuration asSeconds.
- 	newMicros := localOffsetSeconds - newOffset * 1000000 + utcMicroseconds.
- 	^ self class utcMicroseconds: newMicros offset: newOffset
- !

Item was removed:
- ----- Method: DateAndTime>>offsetSeconds (in category 'accessing') -----
- offsetSeconds
- 
- 	^localOffsetSeconds!

Item was removed:
- ----- Method: DateAndTime>>posixEpochJulianDays (in category 'initialize-release') -----
- posixEpochJulianDays
- 
- 	^self class daysFromSmalltalkEpochToPosixEpoch + SqueakEpoch!

Item was removed:
- ----- Method: DateAndTime>>printHMOn: (in category 'squeak protocol') -----
- printHMOn: aStream
- 	"Print just hh:mm"
- 	
- 	| seconds |
- 	seconds := self getSeconds.
- 	seconds // 3600 printOn: aStream base: 10 length: 2 padded: true.
- 	aStream nextPut: $:.
- 	seconds \\ 3600 // 60 printOn: aStream base: 10 length: 2 padded: true.!

Item was removed:
- ----- Method: DateAndTime>>printHMSOn: (in category 'squeak protocol') -----
- printHMSOn: aStream
- 	"Print just hh:mm:ss"
- 	
- 	| seconds |
- 	seconds := self getSeconds.
- 	seconds // 3600 printOn: aStream base: 10 length: 2 padded: true.
- 	aStream nextPut: $:.
- 	seconds \\ 3600 // 60 printOn: aStream base: 10 length: 2 padded: true.
- 	aStream nextPut: $:.
- 	seconds \\ 60 printOn: aStream base: 10 length: 2 padded: true!

Item was removed:
- ----- Method: DateAndTime>>printOn: (in category 'squeak protocol') -----
- printOn: aStream
- 	"Print as per ISO 8601 sections 5.3.3 and 5.4.1.
- 	Prints either:
- 		'YYYY-MM-DDThh:mm:ss.s+ZZ:zz:z' (for positive years) or '-YYYY-MM-DDThh:mm:ss.s+ZZ:zz:z' (for negative years)"
- 
- 	^self printOn: aStream withLeadingSpace: false
- !

Item was removed:
- ----- Method: DateAndTime>>printOn:withLeadingSpace: (in category 'squeak protocol') -----
- printOn: aStream withLeadingSpace: printLeadingSpaceToo
- 	"Print as per ISO 8601 sections 5.3.3 and 5.4.1.
- 	If printLeadingSpaceToo is false, prints either:
- 		'YYYY-MM-DDThh:mm:ss.s+ZZ:zz:z' (for positive years) or '-YYYY-MM-DDThh:mm:ss.s+ZZ:zz:z' (for negative years)
- 	If printLeadingSpaceToo is true, prints either:
- 		' YYYY-MM-DDThh:mm:ss.s+ZZ:zz:z' (for positive years) or '-YYYY-MM-DDThh:mm:ss.s+ZZ:zz:z' (for negative years)
- 	"
- 
- 	| nanos offsetSeconds |
- 	self printYMDOn: aStream withLeadingSpace: printLeadingSpaceToo.
- 	aStream nextPut: $T.
- 	self printHMSOn: aStream.
- 	(nanos := utcMicroseconds \\ 1000000 * 1000) = 0 ifFalse: [
- 		| length |
- 		aStream nextPut: $..
- 		length := 9.
- 		[ nanos \\ 10 = 0 ] whileTrue: [
- 			nanos := nanos // 10.
- 			length := length - 1 ].
- 		nanos asInteger printOn: aStream base: 10 length: length padded: true ].
- 	"Print offset"
- 	aStream nextPut: (localOffsetSeconds >= 0 ifTrue: [ $+ ] ifFalse: [ $- ]).
- 	offsetSeconds := localOffsetSeconds abs.
- 	offsetSeconds // 3600 printOn: aStream base: 10 length: 2 padded: true.
- 	aStream nextPut: $:.
- 	offsetSeconds \\ 3600 // 60 printOn: aStream base: 10 length: 2 padded: true.
- 	(offsetSeconds := offsetSeconds \\ 60) = 0 ifFalse: [
- 		aStream
- 			nextPut: $:;
- 			print: offsetSeconds ]!

Item was removed:
- ----- Method: DateAndTime>>printYMDOn: (in category 'squeak protocol') -----
- printYMDOn: aStream
- 	"Print just YYYY-MM-DD part.
- 	If the year is negative, prints out '-YYYY-MM-DD'."
- 
- 	^self printYMDOn: aStream withLeadingSpace: false.
- !

Item was removed:
- ----- Method: DateAndTime>>printYMDOn:withLeadingSpace: (in category 'squeak protocol') -----
- printYMDOn: aStream withLeadingSpace: printLeadingSpaceToo
- 	"Print just the year, month, and day on aStream.
- 
- 	If printLeadingSpaceToo is true, then print as:
- 		' YYYY-MM-DD' (if the year is positive) or '-YYYY-MM-DD' (if the year is negative)
- 	otherwise print as:
- 		'YYYY-MM-DD' or '-YYYY-MM-DD' "
- 
- 	self dayMonthYearDo: [ :day :month :year |
- 		year negative
- 			ifTrue: [ aStream nextPut: $- ]
- 			ifFalse: [ printLeadingSpaceToo ifTrue: [ aStream space ] ].
- 		year abs printOn: aStream base: 10 length: 4 padded: true.
- 		aStream nextPut: $-.
- 		month printOn: aStream base: 10 length: 2 padded: true.
- 		aStream nextPut: $-.
- 		day printOn: aStream base: 10 length: 2 padded: true ]!

Item was removed:
- ----- Method: DateAndTime>>readDataFrom:size: (in category 'objects from disk') -----
- readDataFrom: aDataStream size: varsOnDisk
- 	"Fill in the fields of self based on the contents of aDataStream. The serialized
- 	data will have four instance variables, because all instances are serialized in a
- 	cononical format as if having originating from an instance with the traditional
- 	seconds/offset/jdn/nanos instance variables."
-  
- 	| seconds offset jdn nanos |
- 	seconds := aDataStream next.
- 	offset := aDataStream next.
- 	jdn := aDataStream next.
- 	nanos := aDataStream next.
- 	localOffsetSeconds := offset ifNil: [ 0 ] ifNotNil: [ :off | off asSeconds ].
- 	utcMicroseconds := self
- 				microsecondsFromDay: jdn
- 				seconds: seconds
- 				nanos: nanos
- 				offset: localOffsetSeconds.!

Item was removed:
- ----- Method: DateAndTime>>second (in category 'ansi protocol') -----
- second
- 
- 	^self getSeconds \\ 60!

Item was removed:
- ----- Method: DateAndTime>>seconds (in category 'smalltalk-80') -----
- seconds
- 
- 	^ self second
- !

Item was removed:
- ----- Method: DateAndTime>>secondsSinceMidnight (in category 'private') -----
- secondsSinceMidnight
- 
- 	^ self getSeconds!

Item was removed:
- ----- Method: DateAndTime>>setJdn:seconds:nano:localOffsetSeconds: (in category 'private') -----
- setJdn: jdn seconds: s nano: n localOffsetSeconds: offset
- 
- 	localOffsetSeconds := offset.
- 	utcMicroseconds := self
- 				microsecondsFromDay: jdn
- 				seconds: s
- 				nanos: n
- 				offset: offset!

Item was removed:
- ----- Method: DateAndTime>>setJdn:seconds:nano:offset: (in category 'squeak protocol') -----
- setJdn: jdn seconds: s nano: n offset: o
- 
- 	self setJdn: jdn seconds: s nano: n localOffsetSeconds: o asSeconds.
- !

Item was removed:
- ----- Method: DateAndTime>>species (in category 'accessing') -----
- species
- 	^DateAndTime!

Item was removed:
- ----- Method: DateAndTime>>storeDataOn: (in category 'objects from disk') -----
- storeDataOn: aDataStream
- 	"Store myself on a DataStream.  Answer self. 
- 	Store 4 variables worth of data, corresponding to the 4 instance variables of the old
- 	DateAndTime implementation, which is to be used as common format for externally
- 	stored instances."
- 
- 	" | dt dt2 |
- 	dt := DateAndTime now.
- 	dt2 := DataStream testWith: dt.
- 	{ dt . dt2 }."
- 
- 	| cntInstVars cntIndexedVars ticks jdn offset seconds nanos |
- 	"Set the instance variable count to 4 to match that of a cononical instance." 
- 	cntInstVars := 4.
- 	cntIndexedVars := self basicSize.
- 	aDataStream
- 		beginInstance: self xxxClass
- 		size: cntInstVars + cntIndexedVars.
- 
- 	"Create the 4 values of the old format DateAndTime"
- 	ticks := self ticks. 	"{days. seconds. nanoSeconds}."
- 	offset := self offset.
- 	jdn := ticks at: 1.
- 	seconds := ticks at: 2.
- 	nanos := ticks at: 3.
- 	aDataStream
- 		nextPut: seconds;
- 		nextPut: offset;
- 		nextPut: jdn;
- 		nextPut: nanos.
- !

Item was removed:
- ----- Method: DateAndTime>>ticks (in category 'private') -----
- ticks
- 	"Private - answer an array with our instance variables. Assumed to be UTC "
- 
- 	^ Array with: self julianDayNumber with: self getSeconds with: self nanoSecond
- !

Item was removed:
- ----- Method: DateAndTime>>ticks:offset: (in category 'private') -----
- ticks: ticks offset: utcOffset
- 	"ticks is {julianDayNumber. secondCount. nanoSeconds}"
- 
- 	| jdn s nanos normalizedTicks |
- 	normalizedTicks := ticks copy.
- 	self normalize: 3 ticks: normalizedTicks base: NanosInSecond.
- 	self normalize: 2 ticks: normalizedTicks base: SecondsInDay.
- 
- 	jdn	:= normalizedTicks at: 1.
- 	s := normalizedTicks at: 2.
- 	nanos := normalizedTicks at: 3.
- 	localOffsetSeconds := utcOffset ifNil: [0] ifNotNil: [utcOffset asSeconds].
- 	utcMicroseconds := self microsecondsFromDay: jdn seconds: s nanos: nanos offset: localOffsetSeconds.
- !

Item was removed:
- ----- Method: DateAndTime>>timeZoneAbbreviation (in category 'ansi protocol') -----
- timeZoneAbbreviation
- 
- 	^ self class localTimeZone abbreviation!

Item was removed:
- ----- Method: DateAndTime>>timeZoneName (in category 'ansi protocol') -----
- timeZoneName
- 
- 	^ self class localTimeZone name!

Item was removed:
- ----- Method: DateAndTime>>to: (in category 'squeak protocol') -----
- to: anEnd
- 	"Answer a Timespan. anEnd conforms to protocol DateAndTime or protocol Timespan"
- 
- 	^ Timespan starting: self ending: (anEnd asDateAndTime)
- !

Item was removed:
- ----- Method: DateAndTime>>to:by: (in category 'squeak protocol') -----
- to: anEnd by: aDuration
- 	"Answer a Timespan. anEnd conforms to protocol DateAndTime or protocol Timespan"
- 
- 	^ (Schedule starting: self ending: (anEnd asDateAndTime))
- 		schedule: (Array with: aDuration asDuration);
- 		yourself
- !

Item was removed:
- ----- Method: DateAndTime>>to:by:do: (in category 'squeak protocol') -----
- to: anEnd by: aDuration do: aBlock
- 	"Answer a Timespan. anEnd conforms to protocol DateAndTime or protocol Timespan"
- 
- 	^ (self to: anEnd by: aDuration) scheduleDo: aBlock!

Item was removed:
- ----- Method: DateAndTime>>utcMicroseconds (in category 'accessing') -----
- utcMicroseconds
- 	^utcMicroseconds!

Item was removed:
- ----- Method: DateAndTime>>utcMicroseconds: (in category 'initialize-release') -----
- utcMicroseconds: utcValue
- 	"Allow value to be modified during initialization from a primitive in order to support
- 	monotonically increasing clock behavior."
- 	utcMicroseconds := utcValue!

Item was removed:
- ----- Method: DateAndTime>>utcMicroseconds:offset: (in category 'initialize-release') -----
- utcMicroseconds: microsecondsSincePosixEpoch offset: tzOffset
- 
- 	utcMicroseconds := microsecondsSincePosixEpoch.
- 	localOffsetSeconds := tzOffset.
- !

Item was removed:
- ----- Method: DateAndTime>>utcOffset: (in category 'squeak protocol') -----
- utcOffset: anOffset 
- 	"Answer a DateAndTime equivalent to the receiver but offset from UTC by anOffset"
- 	^ self class
- 		utcMicroseconds: utcMicroseconds
- 		offset: anOffset asDuration asSeconds!

Item was removed:
- ----- Method: DateAndTime>>year (in category 'ansi protocol') -----
- year
- 	^ self
- 		dayMonthYearDo: [ :d :m :y | y ]
- !

Item was removed:
- Magnitude subclass: #Duration
- 	instanceVariableNames: 'nanos seconds'
- 	classVariableNames: ''
- 	poolDictionaries: 'ChronologyConstants'
- 	category: 'Chronology-Core'!
- 
- !Duration commentStamp: 'dtl 7/11/2009 15:03' prior: 0!
- I represent a duration of time. I have nanosecond precision!

Item was removed:
- ----- Method: Duration class>>days: (in category 'squeak protocol') -----
- days: aNumber
- 
- 	^ self seconds: aNumber * SecondsInDay nanoSeconds: 0!

Item was removed:
- ----- Method: Duration class>>days:hours:minutes:seconds: (in category 'ansi protocol') -----
- days: days hours: hours minutes: minutes seconds: seconds
- 
- 	^ self days: days hours: hours minutes: minutes seconds: seconds nanoSeconds: 0!

Item was removed:
- ----- Method: Duration class>>days:hours:minutes:seconds:nanoSeconds: (in category 'squeak protocol') -----
- days: days hours: hours minutes: minutes seconds: seconds nanoSeconds: nanos	
- 
-  	^self
- 		seconds: seconds
- 			+ (minutes * SecondsInMinute) 
- 			+ (hours * SecondsInHour)
- 			+ (days * SecondsInDay)
- 		nanoSeconds: nanos
- !

Item was removed:
- ----- Method: Duration class>>days:seconds: (in category 'ansi protocol') -----
- days: days seconds: seconds
- 
- 	^ self basicNew seconds: days * SecondsInDay + seconds nanoSeconds: 0
- !

Item was removed:
- ----- Method: Duration class>>fromString: (in category 'squeak protocol') -----
- fromString: aString
- 
- 	^ self readFrom: (ReadStream on: aString)
- !

Item was removed:
- ----- Method: Duration class>>hours: (in category 'squeak protocol') -----
- hours: aNumber
- 
- 	^ self seconds: aNumber * SecondsInHour nanoSeconds: 0!

Item was removed:
- ----- Method: Duration class>>initialize (in category 'initialize-release') -----
- initialize
- 	ChronologyConstants classPool
- 		at: #Zero
- 		put:
- 			(self basicNew
- 				seconds: 0
- 				nanoSeconds: 0) ;
- 		at: #OneDay
- 		put: 1 day!

Item was removed:
- ----- Method: Duration class>>microSeconds: (in category 'squeak protocol') -----
- microSeconds: anInteger
- 	^ self
- 		seconds: (anInteger quo: 1e6)
- 		nanoSeconds: (anInteger rem: 1e6) * 1000!

Item was removed:
- ----- Method: Duration class>>milliSeconds: (in category 'squeak protocol') -----
- milliSeconds: milliCount 
- 	
- 	^self
- 		seconds: (milliCount quo: 1000)
- 		nanoSeconds: (milliCount rem: 1000) * NanosInMillisecond!

Item was removed:
- ----- Method: Duration class>>minutes: (in category 'squeak protocol') -----
- minutes: aNumber
- 
- 	^ self seconds: aNumber * SecondsInMinute nanoSeconds: 0!

Item was removed:
- ----- Method: Duration class>>month: (in category 'squeak protocol') -----
- month: aMonth
- 	"aMonth is an Integer or a String"
- 	
- 	^ (Month month: aMonth year: Year current year) duration
- !

Item was removed:
- ----- Method: Duration class>>nanoSeconds: (in category 'squeak protocol') -----
- nanoSeconds: nanos
- 	"This method is slow. If you have nanos less than 10^6 you should use #seconds:nanoSeconds: instead."
- 
- 	| quo |
- 	quo := nanos quo: NanosInSecond.
- 	^ self basicNew
- 		seconds: quo
- 		nanoSeconds: nanos - (quo * NanosInSecond)
- !

Item was removed:
- ----- Method: Duration class>>oneDay (in category 'squeak protocol') -----
- oneDay
- 	"Answer the canonicalized Duration representing length of 1 day.  Used by Dates."
- 	^ OneDay!

Item was removed:
- ----- Method: Duration class>>readDayHourMinuteSecondNanaFrom: (in category 'squeak protocol') -----
- readDayHourMinuteSecondNanaFrom: aStream
- 	"Formatted as per ANSI 5.8.2.16: [-]D:HH:MM:SS[.S]"
- 
- 	| sign days hours minutes seconds nanos nanosBuffer |
- 	sign := (aStream peekFor: $-) ifTrue: [-1] ifFalse: [1].
- 	days := (aStream upTo: $:) asInteger sign: sign.
- 	hours := (aStream upTo: $:) asInteger sign: sign.
- 	minutes := (aStream upTo: $:) asInteger sign: sign.
- 	seconds := (aStream upTo: $.) asInteger sign: sign.
- 	nanosBuffer := '000000000' copy.
- 	nanos := WriteStream on: nanosBuffer.
- 	[aStream atEnd not and: [aStream peek isDigit]]
- 		whileTrue: [nanos nextPut: aStream next].
- 		
- 	^ { days . hours . minutes . seconds .nanosBuffer asInteger sign: sign }
- 
- 	"	'0:00:00:00' asDuration
- 		'0:00:00:00.000000001' asDuration
- 		'0:00:00:00.999999999' asDuration
- 		'0:00:00:00.100000000' asDuration
- 		'0:00:00:00.001 ' asDuration
- 		'0:00:00:00.1' asDuration
- 		'0:00:00:01 ' asDuration
- 		'0:12:45:45' asDuration
- 		'1:00:00:00' asDuration
- 		'365:00:00:00' asDuration
- 		'-7:09:12:06.10' asDuration
- 		'+0:01:02:3' asDuration
-  	"!

Item was removed:
- ----- Method: Duration class>>readFrom: (in category 'squeak protocol') -----
- readFrom: aStream
- 	"Formatted as per ANSI 5.8.2.16: [-]D:HH:MM:SS[.S]"
- 
- 	| dayHourMinuteSecondNano |
- 	dayHourMinuteSecondNano := self readDayHourMinuteSecondNanaFrom: aStream.
- 		
- 	^ self 
- 		days: dayHourMinuteSecondNano first 
- 		hours: dayHourMinuteSecondNano second 
- 		minutes: dayHourMinuteSecondNano third 
- 		seconds: dayHourMinuteSecondNano fourth 
- 		nanoSeconds: dayHourMinuteSecondNano fifth
- 
- 	"	'0:00:00:00' asDuration
- 		'0:00:00:00.000000001' asDuration
- 		'0:00:00:00.999999999' asDuration
- 		'0:00:00:00.100000000' asDuration
- 		'0:00:00:00.001 ' asDuration
- 		'0:00:00:00.1' asDuration
- 		'0:00:00:01 ' asDuration
- 		'0:12:45:45' asDuration
- 		'1:00:00:00' asDuration
- 		'365:00:00:00' asDuration
- 		'-7:09:12:06.10' asDuration
- 		'+0:01:02:3' asDuration
-  	"!

Item was removed:
- ----- Method: Duration class>>seconds: (in category 'ansi protocol') -----
- seconds: seconds
- 
- 	seconds isInteger
- 		ifTrue: [ ^ self basicNew fullSeconds: seconds ]
- 		ifFalse: [ ^ self seconds: seconds nanoSeconds: 0 ]
- !

Item was removed:
- ----- Method: Duration class>>seconds:nanoSeconds: (in category 'squeak protocol') -----
- seconds: seconds nanoSeconds: nanos
- 
- 	^ self basicNew
- 		seconds: seconds truncated
- 		nanoSeconds: seconds fractionPart * NanosInSecond + nanos!

Item was removed:
- ----- Method: Duration class>>weeks: (in category 'squeak protocol') -----
- weeks: aNumber
- 
- 	^ self days: (aNumber * 7) seconds: 0
- !

Item was removed:
- ----- Method: Duration class>>zero (in category 'ansi protocol') -----
- zero
- 	"Answer the canonicalized instance of Duration zero."
- 	^ Zero!

Item was removed:
- ----- Method: Duration>>* (in category 'ansi protocol') -----
- * operand
- 	"operand is a Number" 	^ self class nanoSeconds: ( (self asNanoSeconds * operand) asInteger)
- !

Item was removed:
- ----- Method: Duration>>+ (in category 'ansi protocol') -----
- + operand
- 
- 	"operand is a Duration" 	^ self class nanoSeconds: (self asNanoSeconds + operand asNanoSeconds)!

Item was removed:
- ----- Method: Duration>>- (in category 'ansi protocol') -----
- - operand
- 	"operand is a Duration" 	^ self + operand negated!

Item was removed:
- ----- Method: Duration>>/ (in category 'ansi protocol') -----
- / operand
- 
- 	"operand is a Duration or a Number"
- 
- 
- 	^ operand isNumber
- 		ifTrue: [ self class nanoSeconds: (self asNanoSeconds / operand) asInteger ]
- 		ifFalse: [ self asNanoSeconds / operand asDuration asNanoSeconds ]
- !

Item was removed:
- ----- Method: Duration>>// (in category 'squeak protocol') -----
- // operand
- 
- 	"operand is a Duration or a Number"
- 
- 
- 	^ operand isNumber
- 		ifTrue: [ self class nanoSeconds: (self asNanoSeconds // operand) asInteger ]
- 		ifFalse: [ self asNanoSeconds // operand asDuration asNanoSeconds ]!

Item was removed:
- ----- Method: Duration>>< (in category 'ansi protocol') -----
- < comparand
- 
- 	^ self asNanoSeconds < comparand asNanoSeconds!

Item was removed:
- ----- Method: Duration>>= (in category 'ansi protocol') -----
- = comparand 
- 	"Answer whether the argument is a <Duration> representing the same 
- 	period of time as the receiver."
- 
- 	^ self == comparand
- 		ifTrue: [true]
- 		ifFalse: 
- 			[self species = comparand species 
- 				ifTrue: [self asNanoSeconds = comparand asNanoSeconds]
- 				ifFalse: [false] ]
- !

Item was removed:
- ----- Method: Duration>>\\ (in category 'squeak protocol') -----
- \\ operand
- 
- 	"modulo. Remainder defined in terms of //. Answer a Duration with the 
- 	same sign as aDuration. operand is a Duration or a Number."
- 
- 	^ operand isNumber
- 		ifTrue: [ self class nanoSeconds: (self asNanoSeconds \\ operand) ]
- 		ifFalse: [ self - (operand * (self // operand)) ]!

Item was removed:
- ----- Method: Duration>>abs (in category 'ansi protocol') -----
- abs
- 
- 	^ self class seconds: seconds abs nanoSeconds: nanos abs!

Item was removed:
- ----- Method: Duration>>adaptToCollection:andSend: (in category 'converting') -----
- adaptToCollection: rcvr andSend: selector
- 	"If I am involved in arithmetic with a Collection, return a Collection of the results of each element combined with me in that expression."
- 
- 	^ rcvr collect: [:element | element perform: selector with: self]!

Item was removed:
- ----- Method: Duration>>ago (in category 'squeak protocol') -----
- ago
- 	"Answer the DateAndTime which was the receiver's duration ago.
- 	e.g., 5 minutes ago.  2 days ago."
- 	^ DateAndTime now - self!

Item was removed:
- ----- Method: Duration>>asDelay (in category 'squeak protocol') -----
- asDelay
- 
- 	^Delay forMilliseconds: self asMilliSeconds
- !

Item was removed:
- ----- Method: Duration>>asDuration (in category 'ansi protocol') -----
- asDuration
- 
- 	^ self!

Item was removed:
- ----- Method: Duration>>asMicroSeconds (in category 'squeak protocol') -----
- asMicroSeconds
- 	nanos = 0 ifTrue: [ ^ seconds * 1e6 ].
- 	^ (seconds * 1e6) + (nanos // 1000)!

Item was removed:
- ----- Method: Duration>>asMilliSeconds (in category 'squeak protocol') -----
- asMilliSeconds
- 
- 	nanos = 0 ifTrue: [ ^seconds * 1000 ].
- 	^nanos // 1000000 + (seconds * 1000)!

Item was removed:
- ----- Method: Duration>>asNanoSeconds (in category 'squeak protocol') -----
- asNanoSeconds
- 
- 	^seconds * NanosInSecond + nanos!

Item was removed:
- ----- Method: Duration>>asSeconds (in category 'ansi protocol') -----
- asSeconds
- 
- 
- 	^ seconds!

Item was removed:
- ----- Method: Duration>>busyWait (in category 'squeak protocol') -----
- busyWait
- 	"BEWARE!! This method is more precise than #wait, but it sacrifices many CPU cycles for that precision. Also note that only processes with a higher priority can run while waiting. See more detailed commentary in Delay >> #busyWait."
- 
- 	^ self asDelay busyWait!

Item was removed:
- ----- Method: Duration>>days (in category 'ansi protocol') -----
- days
- 	"Answer the number of days the receiver represents."
- 
- 	^ seconds quo: SecondsInDay
- !

Item was removed:
- ----- Method: Duration>>fromNow (in category 'squeak protocol') -----
- fromNow
- 	"Answer the DateAndTime which which occurs the receiver's duration from now.
- 	e.g., 5 minutes fromNow.  2 days fromNow."
- 	^ DateAndTime now + self!

Item was removed:
- ----- Method: Duration>>fullSeconds: (in category 'private') -----
- fullSeconds: secondCount
- 	"Private - only used by Duration class"
- 
- 	seconds := secondCount.
- 	nanos := 0.
- !

Item was removed:
- ----- Method: Duration>>hash (in category 'ansi protocol') -----
- hash
- 
-  	^seconds bitXor: nanos!

Item was removed:
- ----- Method: Duration>>hours (in category 'ansi protocol') -----
- hours
- 	"Answer the number of hours the receiver represents."
- 
- 
- 	^ (seconds rem: SecondsInDay) quo: SecondsInHour!

Item was removed:
- ----- Method: Duration>>initialize (in category 'initialize-release') -----
- initialize
- 	self seconds: 0 nanoSeconds: 0.
- !

Item was removed:
- ----- Method: Duration>>isZero (in category 'squeak protocol') -----
- isZero
- 
- 	^ seconds = 0 and: [ nanos = 0 ]
- !

Item was removed:
- ----- Method: Duration>>minutes (in category 'ansi protocol') -----
- minutes
- 
- 	"Answer the number of minutes the receiver represents."
- 
- 
- 	^ (seconds rem: SecondsInHour) quo: SecondsInMinute!

Item was removed:
- ----- Method: Duration>>nanoSeconds (in category 'squeak protocol') -----
- nanoSeconds
- 
- 
- 	^ nanos!

Item was removed:
- ----- Method: Duration>>negated (in category 'ansi protocol') -----
- negated
- 
- 	^ self class seconds: seconds negated nanoSeconds: nanos negated!

Item was removed:
- ----- Method: Duration>>negative (in category 'ansi protocol') -----
- negative
- 
- 
- 	^ self positive not!

Item was removed:
- ----- Method: Duration>>positive (in category 'ansi protocol') -----
- positive
- 
- 
- 	^ seconds = 0 ifTrue: [ nanos positive ] ifFalse: [ seconds positive ]!

Item was removed:
- ----- Method: Duration>>printOn: (in category 'squeak protocol') -----
- printOn: aStream
- 	"Format as per ANSI 5.8.2.16: [-]D:HH:MM:SS[.S]" 	| d h m s n |
- 	d := self days abs.
- 	h := self hours abs.
- 	m := self minutes abs.
-  	s := self seconds abs truncated.
- 	n := self nanoSeconds abs. 	self negative ifTrue: [ aStream nextPut: $- ].
- 	d printOn: aStream. aStream nextPut: $:.
- 	h < 10 ifTrue: [ aStream nextPut: $0. ].
- 	h printOn: aStream. aStream nextPut: $:.
- 	m < 10 ifTrue: [ aStream nextPut: $0. ].
- 	m printOn: aStream. aStream nextPut: $:.
- 	s < 10 ifTrue: [ aStream nextPut: $0. ].
- 	s printOn: aStream.
- 	n = 0 ifFalse:
- 		[ | z ps |
- 		aStream nextPut: $..
- 		ps := n printString padded: #left to: 9 with: $0. 
- 		z := ps findLast: [ :c | c asciiValue > $0 asciiValue ].
- 		ps from: 1 to: z + 2 // 3 * 3 do: [ :c | aStream nextPut: c ] ]
- !

Item was removed:
- ----- Method: Duration>>roundTo: (in category 'squeak protocol') -----
- roundTo: aDuration
- 	"e.g. if the receiver is 5 minutes, 37 seconds, and aDuration is 2 minutes, answer 6 minutes."
- 
- 	^ self class nanoSeconds: (self asNanoSeconds roundTo: aDuration asNanoSeconds)
- !

Item was removed:
- ----- Method: Duration>>seconds (in category 'ansi protocol') -----
- seconds
- 	"Answer the number of seconds the receiver represents."
- 
- 	^seconds rem: SecondsInMinute!

Item was removed:
- ----- Method: Duration>>seconds:nanoSeconds: (in category 'private') -----
- seconds: secondCount nanoSeconds: nanoCount 
- 	"Private - only used by Duration class"
- 
- 	seconds := secondCount.
- 	nanos := nanoCount rounded.
- 	"normalize if signs do not match"
- 	[ nanos < 0 and: [ seconds > 0 ] ]
- 		whileTrue: [ seconds := seconds - 1.
- 			nanos := nanos + NanosInSecond ].
- 	[ seconds < 0 and: [ nanos > 0 ] ]
- 		whileTrue: [ seconds := seconds + 1.
- 			nanos := nanos - NanosInSecond ]
- 
- !

Item was removed:
- ----- Method: Duration>>storeOn: (in category 'private') -----
- storeOn: aStream
- 
- 	aStream
- 		nextPut: $(;
- 		nextPutAll: self className;
- 		nextPutAll: ' seconds: ';
- 		print: seconds;
- 		nextPutAll: ' nanoSeconds: ';
- 		print: nanos;
- 		nextPut: $)
- !

Item was removed:
- ----- Method: Duration>>ticks (in category 'private') -----
- ticks
- 	"Answer an array {days. seconds. nanoSeconds}. Used by DateAndTime and Time."
- 
- 	| days |
- 	days := self days.
- 	^ Array 
- 		with: days
- 		with: seconds - (days * SecondsInDay)
- 		with: nanos
- !

Item was removed:
- ----- Method: Duration>>truncateTo: (in category 'squeak protocol') -----
- truncateTo: aDuration
- 	"e.g. if the receiver is 5 minutes, 37 seconds, and aDuration is 2 minutes, answer 4 minutes."
- 
- 	^ self class
- 		nanoSeconds: (self asNanoSeconds truncateTo: aDuration asNanoSeconds)
- !

Item was removed:
- ----- Method: Duration>>wait (in category 'squeak protocol') -----
- wait
- 	"Convert this duration in a delay and wait once. Answer the created delay so that the client can wait on it again if needed. NOTE THAT for delays shorter than 50 milliseconds, you might want to use #busyWait for greater precision if the higher CPU load and restricted process scheduling are not an issue. See commentary in #busyWait."
- 	
- 	"[3 seconds wait] timeToRun"
- 	
- 	^self asDelay wait!

Item was removed:
- ----- Method: Integer>>asYear (in category '*chronology-core') -----
- asYear
- 
- 	^ Year year: self 
- !

Item was removed:
- Timespan subclass: #Month
- 	instanceVariableNames: ''
- 	classVariableNames: ''
- 	poolDictionaries: 'ChronologyConstants'
- 	category: 'Chronology-Core'!
- 
- !Month commentStamp: 'cbr 7/28/2010 18:11' prior: 0!
- I represent a month.
- 
- For example, to get the number of days this month, you can evaluate the following expression:
- 
- Month current daysInMonth!

Item was removed:
- ----- Method: Month class>>daysInMonth:forYear: (in category 'smalltalk-80') -----
- daysInMonth: indexOrName forYear: yearInteger 
- 
- 	| index |
- 	index := indexOrName isInteger 
- 				ifTrue: [indexOrName]
- 				ifFalse: [self indexOfMonth: indexOrName].
- 	^ (DaysInMonth at: index)
- 			+ ((index = 2
- 					and: [Year isLeapYear: yearInteger])
- 						ifTrue: [1] ifFalse: [0])
- !

Item was removed:
- ----- Method: Month class>>indexOfMonth: (in category 'smalltalk-80') -----
- indexOfMonth: aMonthName
- 
- 
- 	1 to: 12 do: [ :i |  (aMonthName, '*' match: (MonthNames at: i)) ifTrue: [^i] ].
- 	self error: aMonthName , ' is not a recognized month name'.!

Item was removed:
- ----- Method: Month class>>month:year: (in category 'squeak protocol') -----
- month: month year: year 
- 	"Create a Month for the given <year> and <month>.
- 	<month> may be a number or a String with the
- 	name of the month. <year> should be with 4 digits."
- 	^ self starting:
- 		(DateAndTime
- 			year: year
- 			month: month
- 			day: 1
- 			hour: 0
- 			minute: 0
- 			second: 0
- 			offset: self defaultOffset)!

Item was removed:
- ----- Method: Month class>>nameOfMonth: (in category 'smalltalk-80') -----
- nameOfMonth: anIndex
- 
- 	^ MonthNames at: anIndex.!

Item was removed:
- ----- Method: Month class>>readFrom: (in category 'squeak protocol') -----
- readFrom: aStream
- 	| m y |
- 	aStream skipSeparators.
- 	m := aStream upToAnyOf: CharacterSet separators.
- 	aStream skipSeparators.
- 	y := aStream upToEnd.
- 	^ self 
- 		month: m
- 		year: y asInteger
- 
- "Month readFrom: 'July 1998' readStream"!

Item was removed:
- ----- Method: Month class>>starting:duration: (in category 'squeak protocol') -----
- starting: aDateAndTime duration: aDuration 
- 	"Override - a each month has a defined duration"
- 	| start adjusted days |
- 	start := aDateAndTime asDateAndTime.
- 	adjusted := DateAndTime
- 		year: start year
- 		month: start month
- 		day: 1
- 		hour: 0
- 		minute: 0
- 		second: 0
- 		offset: start offset.
- 	days := self
- 		daysInMonth: adjusted month
- 		forYear: adjusted year.
- 	^ super
- 		starting: adjusted
- 		duration: (Duration days: days)!

Item was removed:
- ----- Method: Month>>asMonth (in category 'squeak protocol') -----
- asMonth
- 
- 	^ self!

Item was removed:
- ----- Method: Month>>daysInMonth (in category 'squeak protocol') -----
- daysInMonth
- 
- 	^ self duration days.!

Item was removed:
- ----- Method: Month>>index (in category 'squeak protocol') -----
- index
- 
- 	^ self monthIndex!

Item was removed:
- ----- Method: Month>>name (in category 'squeak protocol') -----
- name
- 
- 
- 	^ self monthName!

Item was removed:
- ----- Method: Month>>previous (in category 'squeak protocol') -----
- previous
- 
- 
- 	^ self class starting: (self start - 1)!

Item was removed:
- ----- Method: Month>>printOn: (in category 'squeak protocol') -----
- printOn: aStream
- 
- 
- 	aStream nextPutAll: self monthName, ' ', self year printString!

Item was removed:
- ----- Method: Number>>asDuration (in category '*chronology-core') -----
- asDuration
- 
- 	^ Duration nanoSeconds: self asInteger
- !

Item was removed:
- ----- Method: Number>>day (in category '*chronology-core') -----
- day
- 
- 	^ self days!

Item was removed:
- ----- Method: Number>>days (in category '*chronology-core') -----
- days
- 
- 	^ Duration days: self!

Item was removed:
- ----- Method: Number>>hour (in category '*chronology-core') -----
- hour
- 
- 	^ self hours
- !

Item was removed:
- ----- Method: Number>>hours (in category '*chronology-core') -----
- hours
- 
- 	^ Duration hours: self!

Item was removed:
- ----- Method: Number>>microSecond (in category '*chronology-core') -----
- microSecond
- 	^ self microSeconds!

Item was removed:
- ----- Method: Number>>microSeconds (in category '*chronology-core') -----
- microSeconds
- 	^ Duration microSeconds: self!

Item was removed:
- ----- Method: Number>>milliSecond (in category '*chronology-core') -----
- milliSecond
- 
- 	^ self milliSeconds
- !

Item was removed:
- ----- Method: Number>>milliSeconds (in category '*chronology-core') -----
- milliSeconds
- 
- 	^ Duration milliSeconds: self
- !

Item was removed:
- ----- Method: Number>>minute (in category '*chronology-core') -----
- minute
- 
- 	^ self minutes
- !

Item was removed:
- ----- Method: Number>>minutes (in category '*chronology-core') -----
- minutes
- 
- 	^ Duration minutes: self!

Item was removed:
- ----- Method: Number>>nanoSecond (in category '*chronology-core') -----
- nanoSecond
- 
- 	^ self nanoSeconds
- !

Item was removed:
- ----- Method: Number>>nanoSeconds (in category '*chronology-core') -----
- nanoSeconds
- 
- 	^ Duration nanoSeconds: self.!

Item was removed:
- ----- Method: Number>>second (in category '*chronology-core') -----
- second
- 
- 	^ self seconds
- !

Item was removed:
- ----- Method: Number>>seconds (in category '*chronology-core') -----
- seconds
- 
- 	^ Duration seconds: self!

Item was removed:
- ----- Method: Number>>week (in category '*chronology-core') -----
- week
- 
- 	^ self weeks
- !

Item was removed:
- ----- Method: Number>>weeks (in category '*chronology-core') -----
- weeks
- 
- 	^ Duration weeks: self!

Item was removed:
- Timespan subclass: #Schedule
- 	instanceVariableNames: 'schedule'
- 	classVariableNames: ''
- 	poolDictionaries: ''
- 	category: 'Chronology-Core'!
- 
- !Schedule commentStamp: 'brp 5/13/2003 09:48' prior: 0!
- I represent a powerful class for implementing recurring schedules.!

Item was removed:
- ----- Method: Schedule>>between:and:do: (in category 'enumerating') -----
- between: aStart and: anEnd do: aBlock
- 
- 	| element end i |
- 	end := self end min: anEnd.
- 	element := self start.
- 	
- 	i := 1.
- 	[ element < aStart ] whileTrue:
- 	
- 	[ element := element + (schedule at: i).
- 		i := i + 1. (i > schedule size) ifTrue: [i := 1]].
- 	i := 1.
- 	[ element <= end ] whileTrue:
- 	
- 	[ aBlock value: element.
- 		element := element + (schedule at: i).
- 		i := i + 1.
- 		(i > schedule size) ifTrue: [i := 1]]
- !

Item was removed:
- ----- Method: Schedule>>dateAndTimes (in category 'enumerating') -----
- dateAndTimes
- 
- 	| dateAndTimes |
- 	dateAndTimes := OrderedCollection new.
- 	self scheduleDo: [ :e | dateAndTimes add: e ].
- 	^ dateAndTimes asArray!

Item was removed:
- ----- Method: Schedule>>includes: (in category 'squeak protocol') -----
- includes: aDateAndTime
- 
- 	| dt |
- 	dt := aDateAndTime asDateAndTime.
- 	self scheduleDo: [ :e | e = dt ifTrue: [^true] ].
- 	^ false
- !

Item was removed:
- ----- Method: Schedule>>schedule (in category 'enumerating') -----
- schedule
- 	^ schedule!

Item was removed:
- ----- Method: Schedule>>schedule: (in category 'enumerating') -----
- schedule: anArrayOfDurations
- 
- 	schedule := anArrayOfDurations!

Item was removed:
- ----- Method: Schedule>>scheduleDo: (in category 'enumerating') -----
- scheduleDo: aBlock
- 
- 	self between: (self start) and: (self end) do: aBlock
- !

Item was removed:
- Object subclass: #Stopwatch
- 	instanceVariableNames: 'timespans state'
- 	classVariableNames: ''
- 	poolDictionaries: ''
- 	category: 'Chronology-Core'!
- 
- !Stopwatch commentStamp: '<historical>' prior: 0!
- A Stopwatch maintains a collection of timespans.!

Item was removed:
- ----- Method: Stopwatch>>activate (in category 'squeak protocol') -----
- activate
- 
- 	self isSuspended ifTrue:
- 		[self timespans add: 
- 			(Timespan starting: DateAndTime now duration: Duration zero).
- 		self state: #active]
- !

Item was removed:
- ----- Method: Stopwatch>>duration (in category 'squeak protocol') -----
- duration
- 
- 	| ts last |
- 	self isSuspended 
- 		ifTrue:
- 			[ (ts := self timespans) isEmpty ifTrue: 
- 				[ ts := { Timespan starting: DateAndTime now duration: Duration zero } ] ]
- 		ifFalse:
- 			[ last := self timespans last.
- 			ts := self timespans allButLast
- 				add: (last duration: (DateAndTime now - last start); yourself);
- 				yourself ].
- 		
- 	^ (ts collect: [ :t | t duration ]) sum!

Item was removed:
- ----- Method: Stopwatch>>end (in category 'squeak protocol') -----
- end
- 
- 	^ self timespans last next
- 
- !

Item was removed:
- ----- Method: Stopwatch>>isActive (in category 'squeak protocol') -----
- isActive
- 
- 	^ self state = #active
- !

Item was removed:
- ----- Method: Stopwatch>>isSuspended (in category 'squeak protocol') -----
- isSuspended
- 
- 	^ self state = #suspended
- 
- !

Item was removed:
- ----- Method: Stopwatch>>postCopy (in category 'copying') -----
- postCopy
- 	super postCopy.
- 	timespans := timespans copy!

Item was removed:
- ----- Method: Stopwatch>>printOn: (in category 'squeak protocol') -----
- printOn: aStream
- 
- 	super printOn: aStream.
- 	aStream
- 		nextPut: $(;
- 		nextPutAll: self state;
- 		nextPut: $:;
- 		print: self duration;
- 		nextPut: $).
- 
- !

Item was removed:
- ----- Method: Stopwatch>>reActivate (in category 'squeak protocol') -----
- reActivate
- 
- 	self 
- 		suspend;
- 		activate.
- !

Item was removed:
- ----- Method: Stopwatch>>reset (in category 'squeak protocol') -----
- reset
- 
- 	self suspend.
- 	timespans := nil
- !

Item was removed:
- ----- Method: Stopwatch>>start (in category 'squeak protocol') -----
- start
- 
- 	^ self timespans first start
- 
- !

Item was removed:
- ----- Method: Stopwatch>>state (in category 'squeak protocol') -----
- state
- 
- 	^ state ifNil: [ state := #suspended ]!

Item was removed:
- ----- Method: Stopwatch>>state: (in category 'squeak protocol') -----
- state: aSymbol
- 
- 	state := aSymbol!

Item was removed:
- ----- Method: Stopwatch>>suspend (in category 'squeak protocol') -----
- suspend
- 
- 	| ts |
- 	self isActive ifTrue:
- 		[ ts := self timespans last.
- 		ts duration: (DateAndTime now - ts start).
- 		self state: #suspended]!

Item was removed:
- ----- Method: Stopwatch>>timespans (in category 'squeak protocol') -----
- timespans
- 
- 	^ timespans ifNil: [ timespans := OrderedCollection new ]!

Item was removed:
- ----- Method: String>>asDate (in category '*chronology-core') -----
- asDate
- 	"Many allowed forms, see Date>>#readFrom:"
- 
- 	^ Date fromString: self!

Item was removed:
- ----- Method: String>>asDateAndTime (in category '*chronology-core') -----
- asDateAndTime
- 
- 	"Convert from UTC format" 	^ DateAndTime fromString: self!

Item was removed:
- ----- Method: String>>asDuration (in category '*chronology-core') -----
- asDuration
- 	"convert from [nnnd]hh:mm:ss[.nanos] format. [] implies optional elements"
- 
- 	^ Duration fromString: self
- !

Item was removed:
- ----- Method: String>>asTime (in category '*chronology-core') -----
- asTime
- 	"Many allowed forms, see Time>>readFrom:"
- 
- 	^ Time fromString: self.!

Item was removed:
- ----- Method: String>>asTimeStamp (in category '*chronology-core') -----
- asTimeStamp
- 	"Convert from obsolete TimeStamp format"
- 
- 	^ TimeStamp fromString: self!

Item was removed:
- Magnitude subclass: #Time
- 	instanceVariableNames: 'seconds nanos'
- 	classVariableNames: 'ClockPolicy HighResClockTicksPerMillisecond LastClockTick UpdateVMTimeZoneCacheAt UseHighResClockForTiming'
- 	poolDictionaries: 'ChronologyConstants'
- 	category: 'Chronology-Core'!
- 
- !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.
- !

Item was removed:
- ----- Method: Time class>>benchmarkMillisecondClock (in category 'benchmarks') -----
- benchmarkMillisecondClock		"Time benchmarkMillisecondClock"
- 
- 	"Benchmark the time spent in a call to Time>>millisecondClockValue.
- 
- 	On the VM level this tests the efficiency of calls to ioMSecs()."
- 
- 	"PII/400 Windows 98: 0.725 microseconds per call"
- 
- 	| temp1 temp2 temp3 delayTime nLoops time |
- 
- 	delayTime := 5000. "Time to run benchmark is approx. 2*delayTime"
- 
- 
- 
- 	"Don't run the benchmark if we have an active delay since
- 
- 	we will measure the additional penalty in the primitive dispatch
- 
- 	mechanism (see #benchmarkPrimitiveResponseDelay)."
- 
- 	Delay anyActive ifTrue:[
- 
- 		^self notify:'Some delay is currently active.
- 
- Running this benchmark will not give any useful result.'].
- 
- 
- 
- 	"Flush the cache for this benchmark so we will have
- 
- 	a clear cache hit for each send to #millisecondClockValue below"
- 
- 	Object flushCache.
- 
- 	temp1 := 0.
- 
- 	temp2 := self. "e.g., temp1 == Time"
- 
- 	temp3 := self millisecondClockValue + delayTime.
- 
- 
- 
- 	"Now check how often we can run the following loop in the given time"
- 
- 	[temp2 millisecondClockValue < temp3]
- 
- 		whileTrue:[temp1 := temp1 + 1].
- 
- 
- 
- 	nLoops := temp1. "Remember the loops we have run during delayTime"
- 
- 
- 
- 	"Setup the second loop"
- 
- 	temp1 := 0.
- 
- 	temp3 := nLoops.
- 
- 
- 
- 	"Now measure how much time we spend without sending #millisecondClockValue"
- 
- 	time := Time millisecondClockValue.
- 
- 	[temp1 < temp3]
- 
- 		whileTrue:[temp1 := temp1 + 1].
- 
- 	time := Time millisecondClockValue - time.
- 
- 
- 
- 	"And compute the number of microseconds spent per call to #millisecondClockValue"
- 
- 	^((delayTime - time * 1000.0 / nLoops) truncateTo: 0.001) printString,
- 
- 		' microseconds per call to Time>>millisecondClockValue'
- !

Item was removed:
- ----- Method: Time class>>benchmarkPrimitiveResponseDelay (in category 'benchmarks') -----
- benchmarkPrimitiveResponseDelay	"Time benchmarkPrimitiveResponseDelay"
- 
- 	"Benchmark the overhead for primitive dispatches with an active Delay.
- 
- 	On the VM level, this tests the efficiency of ioLowResMSecs."
- 
- 
- 
- 	"PII/400 Windows98: 0.128 microseconds per prim"
- 
- 
- 
- 	"ar 9/6/1999: This value is *extremely* important for stuff like sockets etc.
- 
- 	I had a bad surprise when Michael pointed this particular problem out:
- 
- 	Using the hardcoded clock() call for ioLowResMSecs on Win32 resulted in an overhead
- 
- 	of 157.4 microseconds per primitive call - meaning you can't get no more than
- 
- 	approx. 6000 primitives per second on my 400Mhz PII system with an active delay!!
- 
- 	BTW, it finally explains why Squeak seemed soooo slow when running PWS or 
- 
- 	other socket stuff. The new version (not using clock() but some Windows function) 
- 
- 	looks a lot better (see above; approx. 8,000,000 prims per sec with an active delay)."
- 
- 
- 
- 	| nLoops bb index baseTime actualTime delayTime |
- 
- 	delayTime := 5000. "Time to run this test is approx. 3*delayTime"
- 
- 
- 
- 	Delay anyActive ifTrue:[
- 
- 		^self notify:'Some delay is currently active.
- 
- Running this benchmark will not give any useful result.'].
- 
- 
- 
- 	bb := Array new: 1. "The object we send the prim message to"
- 
- 
- 
- 	"Compute the # of loops we'll run in a decent amount of time"
- 
- 	[(Delay forMilliseconds: delayTime) wait] 
- 
- 		forkAt: Processor userInterruptPriority.
- 
- 
- 
- 	nLoops := 0.
- 
- 	[Delay anyActive] whileTrue:[
- 
- 		bb basicSize; basicSize; basicSize; basicSize; basicSize; 
- 
- 			basicSize; basicSize; basicSize; basicSize; basicSize.
- 
- 		nLoops := nLoops + 1.
- 
- 	].
- 
- 
- 
- 	"Flush the cache and make sure #basicSize is in there"
- 
- 	Object flushCache.
- 
- 	bb basicSize.
- 
- 
- 
- 	"Now run the loop without any active delay
- 
- 	for getting an idea about its actual speed."
- 
- 	baseTime := self millisecondClockValue.
- 
- 	index := nLoops.
- 
- 	[index > 0] whileTrue:[
- 
- 		bb basicSize; basicSize; basicSize; basicSize; basicSize; 
- 
- 			basicSize; basicSize; basicSize; basicSize; basicSize.
- 
- 		index := index - 1.
- 
- 	].
- 
- 	baseTime := self millisecondClockValue - baseTime.
- 
- 
- 
- 	"Setup the active delay but try to never make it active"
- 
- 	[(Delay forMilliseconds: delayTime + delayTime) wait] 
- 
- 		forkAt: Processor userInterruptPriority.
- 
- 
- 
- 	"And run the loop"
- 
- 	actualTime := self millisecondClockValue.
- 
- 	index := nLoops.
- 
- 	[index > 0] whileTrue:[
- 
- 		bb basicSize; basicSize; basicSize; basicSize; basicSize; 
- 
- 			basicSize; basicSize; basicSize; basicSize; basicSize.
- 
- 		index := index - 1.
- 
- 	].
- 
- 	actualTime := self millisecondClockValue - actualTime.
- 
- 
- 
- 	"And get us some result"
- 
- 	^((actualTime - baseTime) * 1000 asFloat / (nLoops * 10) truncateTo: 0.001) printString,
- 
- 		' microseconds overhead per primitive call'
- !

Item was removed:
- ----- Method: Time class>>clockPolicy (in category 'class initialization') -----
- clockPolicy
- 
- 	^ClockPolicy!

Item was removed:
- ----- Method: Time class>>clockPolicy: (in category 'class initialization') -----
- clockPolicy: aSymbol
- 	"When sequencial calls are made to DateAndTime now, it may be desirable to
- 	force the system clock to be monotonic, and it may be desirable for the clock
- 	to appear to be strictly increasing with no repeat values. The ClockPolicy
- 	identifies which of several possible strategies to use.
- 
- 	Allowable values are
- 		#acceptPlatformTime
- 		#monotonicAllowDuplicates
- 		#monotonicForceMicrosecondIncrement
- 		#monotonicForceNanosecondIncrement "
- 
- 	self assert: (
- 		#(
- 			acceptPlatformTime
- 			monotonicAllowDuplicates
- 			monotonicForceMicrosecondIncrement
- 			monotonicForceNanosecondIncrement) includes: aSymbol).
- 	ClockPolicy := aSymbol!

Item was removed:
- ----- Method: Time class>>condenseBunches: (in category 'general inquiries') -----
- condenseBunches: aCollectionOfSeconds
- 	| secArray now out pause prev bunchEnd |
- 	"Identify the major intervals in a bunch of numbers.  
- 	Each number is a seconds since 1901 that represents a date and time.
- 	We want the last event in a bunch.  Return array of seconds for:
- 	
- 	Every event in the last half hour.
- 		Every bunch separated by 30 min in the last 24 hours.
- 	
- 	Every bunch separated by two hours before that."
- 
- 	"Time condenseBunches: 
- 		(#(20 400 401  20000 20200 20300 40000 45000  200000 201000 202000) 
- 			collect: [ :tt | self totalSeconds - tt])
- "
- 
- 	secArray := aCollectionOfSeconds asSortedCollection.
- 	pause := 1.
- 	now := self totalSeconds.
- 	out := OrderedCollection new.
- 	prev := 0.
- 	bunchEnd := nil.
- 	secArray reverseDo: [:secs | | ago | "descending"
- 		ago := now - secs.
- 		ago > (60*30) ifTrue: [pause := "60*30" 1800].
- 		ago > (60*60*24) ifTrue: [pause := "60*120" 7200].
- 		ago - prev >= pause ifTrue: [out add: bunchEnd.  bunchEnd := secs].
- 		prev := ago].
- 	out add: bunchEnd.
- 	out removeFirst.
- 	^ out
- !

Item was removed:
- ----- Method: Time class>>current (in category 'squeak protocol') -----
- current 
- 
- 	^ self now!

Item was removed:
- ----- Method: Time class>>dateAndTimeFromSeconds: (in category 'smalltalk-80') -----
- dateAndTimeFromSeconds: secondCount
- 
- 	^ Array
- 		with: (Date fromSeconds: secondCount)
- 		with: (Time fromSeconds: secondCount \\ 86400)!

Item was removed:
- ----- Method: Time class>>dateAndTimeNow (in category 'smalltalk-80') -----
- dateAndTimeNow
- 	"Answer a two-element Array of (Date today, Time now)."
- 
- 	^ self dateAndTimeFromSeconds: self totalSeconds
- !

Item was removed:
- ----- Method: Time class>>durationToRun: (in category 'general inquiries') -----
- durationToRun: timedBlock
- 	"Answer a duration timedBlock takes to return its value"
- 
- 	^(self nanosecondsToRun: timedBlock) nanoSeconds!

Item was removed:
- ----- Method: Time class>>estimateHighResClockTicksPerMillisecond (in category 'clock') -----
- estimateHighResClockTicksPerMillisecond
- 
- 	| t0 t1 t2 t3 |
- 	
- 	"Count the ticks ellapsed during a 10ms busy loop"
- 	t0 := Time utcMicrosecondClock + 200.
- 	[Time utcMicrosecondClock >= t0] whileFalse.
- 	t1 := self highResClock.
- 	[Time utcMicrosecondClock >= (t0 + 10000)] whileFalse.
- 	t1 := self highResClock - t1 * 1000 // (Time utcMicrosecondClock - t0).
- 	
- 	"Count the ticks ellapsed during a 20ms busy loop"
- 	t0 := Time utcMicrosecondClock + 200.
- 	[Time utcMicrosecondClock >= t0] whileFalse.
- 	t2 := self highResClock.
- 	[Time utcMicrosecondClock >= (t0 + 20000)] whileFalse.
- 	t2 := self highResClock - t2 * 1000 // (Time utcMicrosecondClock - t0).
- 	
- 	"Count the ticks ellapsed during a 30ms busy loop"
- 	t0 := Time utcMicrosecondClock + 200.
- 	[Time utcMicrosecondClock >= t0] whileFalse.
- 	t3 := self highResClock.
- 	[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 removed:
- ----- Method: Time class>>eventMillisecondClock (in category 'clock') -----
- eventMillisecondClock
- 	"In order to make certain event handling code work (cf MouseEvent>asMouseMove) we need access
- 	to the tick kept by ioMSecs() "
- 	"Time eventMillisecondClock"
- 	<primitive: 135>
- 	^0!

Item was removed:
- ----- Method: Time class>>fromSeconds: (in category 'smalltalk-80') -----
- fromSeconds: secondCount 
- 	"Answer an instance of me that is secondCount number of seconds since midnight."
- 
- 	| integerSeconds nanos |
- 	integerSeconds := secondCount truncated.
- 	integerSeconds = secondCount
- 		ifTrue: [nanos := 0]
- 		ifFalse: [nanos := (secondCount - integerSeconds * NanosInSecond) asInteger].
- 	^ self seconds: integerSeconds nanoSeconds: nanos
- !

Item was removed:
- ----- Method: Time class>>highResClock (in category 'clock') -----
- highResClock
- 	"Time highResClock"
- 	"Primitive. Answer the value of the high resolution clock if this computer has one.
- 	Usually, this should be the highest resolution value available, for example on Intel
- 	it will be the value of the time stamp counter register."
- 	<primitive: 'primitiveHighResClock'>
- 	^0!

Item was removed:
- ----- Method: Time class>>highResClockTicksPerMillisecond (in category 'clock') -----
- highResClockTicksPerMillisecond
- 	HighResClockTicksPerMillisecond = 0
- 		ifTrue:
- 			[HighResClockTicksPerMillisecond := self estimateHighResClockTicksPerMillisecond].
- 	^HighResClockTicksPerMillisecond!

Item was removed:
- ----- Method: Time class>>hour:minute:second: (in category 'squeak protocol') -----
- hour: hour minute: minute second: second
- 	"Answer a Time"
- 
- 	^ self hour: hour minute: minute second: second nanoSecond: 0
- !

Item was removed:
- ----- Method: Time class>>hour:minute:second:nanoSecond: (in category 'squeak protocol') -----
- hour: hour minute: minute second: second  nanoSecond: nanoCount
- 	"Answer a Time - only second precision for now"
- 
- 	^ self 
- 		seconds: (hour * SecondsInHour) + (minute * SecondsInMinute) + second 
- 		nanoSeconds: nanoCount
- !

Item was removed:
- ----- Method: Time class>>humanWordsForSecondsAgo: (in category 'general inquiries') -----
- humanWordsForSecondsAgo: secs
- 	| date today |
- 	"Return natural language for this date and time in the past."
- 
- 	secs <= 1 ifTrue: [^ 'a second ago'].
- 	secs < 45 ifTrue: [^ secs printString, ' seconds ago'].
- 	secs < 90 ifTrue: [^ 'a minute ago'].
- 	secs < "45*60" 2700 ifTrue: [^ (secs//60) printString, ' minutes ago'].
- 	secs < "90*60" 5400 ifTrue: [^ 'an hour ago'].
- 	secs < "18*60*60" 64800 ifTrue: [^ (secs//3600) printString, ' hours ago'].
- 	date := Date fromSeconds: self totalSeconds - secs.		"now work with dates"
- 	today := Date today.
- 	date > (today subtractDays: 2) ifTrue: [^ 'yesterday'].
- 	date > (today subtractDays: 8) ifTrue: [^ 'last ', date dayOfWeekName].
- 	date > (today subtractDays: 13) ifTrue: [^ 'a week ago'].
- 	date > (today subtractDays: 28) ifTrue: [
- 		^ ((today subtractDate: date)//7) printString, ' weeks ago'].
- 	date > (today subtractDays: 45) ifTrue: [^ 'a month ago'].
- 	date > (today subtractDays: 300) ifTrue: [^ 'last ', date monthName].
- 	^ date monthName, ', ', date year printString
- 
- "Example
- #(0.5 30 62 130 4000 10000 60000 90000 345600 864000 1728000 3456000 17280000 34560000 345600000) 
- 		collect: [:ss | Time humanWordsForSecondsAgo: ss].
- "
- !

Item was removed:
- ----- Method: Time class>>initialize (in category 'class initialization') -----
- initialize
- 	" self initialize "
- 
- 	LastClockTick ifNil: [ LastClockTick := 0 ].
- 	
- 	HighResClockTicksPerMillisecond ifNil: [ HighResClockTicksPerMillisecond := 0 ].
- 
- 	ClockPolicy ifNil: [
- 		"self clockPolicy: #acceptPlatformTime."
- 		self clockPolicy: #monotonicAllowDuplicates.
- 		"self clockPolicy: #monotonicForceMicrosecondIncrement."
- 		"self clockPolicy: #monotonicForceNanosecondIncrement." ]!

Item was removed:
- ----- 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 utcMicrosecondClock + (DateAndTime localOffsetSeconds * 1000000)!

Item was removed:
- ----- Method: Time class>>localMicrosecondClockPrimitive (in category 'clock') -----
- localMicrosecondClockPrimitive
- 	"Answer the local 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, and with an offset duration corresponding to the current
- 	 offset of local time from UTC."
- 	<primitive: 241>
- 	^0!

Item was removed:
- ----- Method: Time class>>localMicrosecondClockWithOffset (in category 'clock') -----
- localMicrosecondClockWithOffset
- 	"Answer an array with local microseconds since the Smalltalk epoch and the
- 	current seconds offset from GMT in the local time zone."
- 
- 	| result |
- 	result := self posixMicrosecondClockWithOffset.
- 	"DateAndTime unixEpoch asSeconds"
- 	result at: 1 put: result first + ((2177452800 + result second) * 1000000).
- 	^result!

Item was removed:
- ----- Method: Time class>>microsecondsToRun: (in category 'general inquiries') -----
- microsecondsToRun: timedBlock 
- 	"Answer the number of microseconds timedBlock takes to return its value."
- 
- 	| startUsecs |
- 	(self useHighResClockForTiming and: [self highResClock ~= 0])
- 		ifTrue: [	^(self nanosecondsToRunHighRes: timedBlock) + 500 // 1000].
- 	startUsecs := self utcMicrosecondClock.
- 	timedBlock value.
- 	^self utcMicrosecondClock - startUsecs!

Item was removed:
- ----- Method: Time class>>midnight (in category 'squeak protocol') -----
- midnight
- 
- 	^ self seconds: 0
- !

Item was removed:
- ----- Method: Time class>>milliSecondsSinceMidnight (in category 'ansi protocol') -----
- milliSecondsSinceMidnight
- 	^self localMicrosecondClock // 1000 \\ 86400000 "24 * 60 * 60 * 1000"!

Item was removed:
- ----- Method: Time class>>millisecondClock (in category 'general inquiries') -----
- millisecondClock
- 	"Answer the value of the millisecond clock. Unlike older implementatins, this is a clock; it will never roll-over."
- 
- 	^self utcMicrosecondClock // 1000!

Item was removed:
- ----- Method: Time class>>millisecondClockValue (in category 'general inquiries') -----
- millisecondClockValue
- 	"Answer the value of the millisecond clock."
- 
- 	^self utcMicrosecondClock // 1000!

Item was removed:
- ----- Method: Time class>>milliseconds:since: (in category 'squeak protocol') -----
- milliseconds: currentTime since: lastTime
- 	"Answer the elapsed time since last recorded in milliseconds (i.e. of millisecondClockValue).
- 	 Since the time basis is now a 61-bit or greater UTC microsecond clock, rollover is no longer an issue."
- 
- 	^currentTime - lastTime!

Item was removed:
- ----- Method: Time class>>millisecondsSince: (in category 'squeak protocol') -----
- millisecondsSince: lastTime
- 	"Answer the elapsed time since last recorded in milliseconds.
- 	Compensate for rollover."
- 
- 	^self milliseconds: self millisecondClockValue since: lastTime
- !

Item was removed:
- ----- Method: Time class>>millisecondsToRun: (in category 'general inquiries') -----
- millisecondsToRun: timedBlock 
- 	"Answer the number of milliseconds timedBlock takes to return its value."
- 
- 	^(self microsecondsToRun: timedBlock) + 500 // 1000!

Item was removed:
- ----- Method: Time class>>namesForTimes: (in category 'general inquiries') -----
- namesForTimes: arrayOfSeconds
- 	| simpleEnglish final prev |
- 	"Return English descriptions of the times in the array.  They are each seconds since 1901.  If two names are the same, append the date and time to distinguish them."
- 
- 	simpleEnglish := arrayOfSeconds collect: [:secsAgo |
- 		self humanWordsForSecondsAgo: self totalSeconds - secsAgo].
- 	prev := ''.
- 	final := simpleEnglish copy.
- 	simpleEnglish withIndexDo: [:eng :ind | | prevPair myPair | 
- 		eng = prev ifFalse: [eng]
- 			ifTrue: ["both say 'a month ago'"
- 				prevPair := self dateAndTimeFromSeconds: 
- 						(arrayOfSeconds at: ind-1).
- 				myPair := self dateAndTimeFromSeconds: 
- 						(arrayOfSeconds at: ind).
- 				(final at: ind-1) = prev ifTrue: ["only has 'a month ago'"
- 					final at: ind-1 put: 
- 							(final at: ind-1), ', ', prevPair first mmddyyyy].
- 				final at: ind put: 
- 							(final at: ind), ', ', myPair first mmddyyyy.
- 				prevPair first = myPair first 
- 					ifTrue: [
- 						(final at: ind-1) last == $m ifFalse: ["date but no time"
- 							final at: ind-1 put: 
- 								(final at: ind-1), ', ', prevPair second printMinutes].
- 						final at: ind put: 
- 							(final at: ind), ', ', myPair second printMinutes]].
- 		prev := eng].
- 	^ final
- !

Item was removed:
- ----- Method: Time class>>nanosecondsToRun: (in category 'general inquiries') -----
- nanosecondsToRun: timedBlock
- 	"Answer the number of nanoseconds timedBlock takes to return its value.
- 	Use high resolution clock if available and preferred."
- 
- 	| startUsecs |
- 	(self useHighResClockForTiming and: [self highResClock ~= 0])
- 		ifTrue: [	^(self nanosecondsToRunHighRes: timedBlock)].
- 	"Fallback to microseconds clock"
- 	startUsecs := self utcMicrosecondClock.
- 	timedBlock value.
- 	^self utcMicrosecondClock - startUsecs * 1000!

Item was removed:
- ----- Method: Time class>>nanosecondsToRunHighRes: (in category 'general inquiries') -----
- nanosecondsToRunHighRes: timedBlock
- 	"Answer the number of nanoseconds timedBlock takes to return its value using high resolution clock.
- 	This assumes that high resolution clock is available, has a constant rate, and is synchronized between multi-core CPU"
- 
- 	| ticks |
- 	ticks := self highResClock.
- 	timedBlock value.
- 	^(self highResClock - ticks
- 		+ (self highResClock - self highResClock ) "subtract the ticks taken by the call to highResClock itself"
- 		* 1e6 // self highResClockTicksPerMillisecond) "and convert ticks to nanoSeconds"!

Item was removed:
- ----- Method: Time class>>new (in category 'smalltalk-80') -----
- new
- 	"Answer a Time representing midnight"
- 
- 	^ self midnight!

Item was removed:
- ----- Method: Time class>>noon (in category 'squeak protocol') -----
- noon
- 
- 	^ self seconds: (SecondsInDay / 2)
- !

Item was removed:
- ----- Method: Time class>>now (in category 'ansi protocol') -----
- now
- 	"Answer a Time representing the time right now - this is a 24 hour clock."
- 	| localUsecs localUsecsToday |
- 	localUsecs := self localMicrosecondClock.
- 	localUsecsToday := localUsecs \\ MicrosecondsInDay.
- 	^ self
- 		seconds: localUsecsToday // 1000000
- 		nanoSeconds: localUsecsToday \\ 1000000 * 1000!

Item was removed:
- ----- Method: Time class>>posixMicrosecondClockWithOffset (in category 'clock') -----
- posixMicrosecondClockWithOffset
- 	"Answer an array with local microseconds since the Posix epoch and the
- 	current seconds offset from GMT in the local time zone."
- 
- 	| array posixUtcValue |
- 	array := self primPosixMicrosecondClockWithOffset: (Array new: 2).
- 	posixUtcValue := array at: 1.
- 	(self updateTimeZoneCacheAt: posixUtcValue) ifTrue: [ "Time zone may have changed: fetch again."
- 		self primPosixMicrosecondClockWithOffset: array.
- 		posixUtcValue := array at: 1 ].
- 	ClockPolicy caseOf: {
- 		[#acceptPlatformTime] -> [^ array] .
- 		[#monotonicAllowDuplicates] -> [
- 			posixUtcValue > LastClockTick
- 				ifTrue: [LastClockTick := posixUtcValue]
- 				ifFalse: [array at: 1 put: LastClockTick]] .
- 		[#monotonicForceMicrosecondIncrement] -> [
- 			posixUtcValue > LastClockTick
- 				ifTrue: [LastClockTick := posixUtcValue]
- 				ifFalse: [LastClockTick := LastClockTick + 1. "add one microsecond"
- 					array at: 1 put: LastClockTick]] .
- 		[#monotonicForceNanosecondIncrement] -> [
- 			posixUtcValue > LastClockTick
- 				ifTrue: [LastClockTick := posixUtcValue]
- 				ifFalse: [LastClockTick := LastClockTick + (1 / 1000). "add one nanosecond"
- 					array at: 1 put: LastClockTick]]
- 	} otherwise: [].
- 	^array!

Item was removed:
- ----- Method: Time class>>posixMicrosecondClockWithOffset: (in category 'clock') -----
- posixMicrosecondClockWithOffset: aDateAndTime
- 	"Initialize aDateAndTime initialized with local microseconds since the Posix
- 	epoch and the current seconds offset from GMT in the local time zone."
- 
- 	| posixUtcValue |
- 	self primPosixMicrosecondClockWithOffset: aDateAndTime.
- 	posixUtcValue := aDateAndTime utcMicroseconds.
- 	(self updateTimeZoneCacheAt: posixUtcValue) ifTrue: [ "Time zone may have changed: fetch again."
- 		self primPosixMicrosecondClockWithOffset: aDateAndTime .
- 		posixUtcValue := aDateAndTime utcMicroseconds ].
- 	ClockPolicy caseOf: {
- 		[#acceptPlatformTime] -> [^ aDateAndTime] .
- 		[#monotonicAllowDuplicates] -> [
- 			posixUtcValue > LastClockTick
- 				ifTrue: [LastClockTick := posixUtcValue]
- 				ifFalse: [aDateAndTime utcMicroseconds: LastClockTick]] .
- 		[#monotonicForceMicrosecondIncrement] -> [
- 			posixUtcValue > LastClockTick
- 				ifTrue: [LastClockTick := posixUtcValue]
- 				ifFalse: [LastClockTick := LastClockTick + 1. "add one microsecond"
- 					aDateAndTime utcMicroseconds: LastClockTick]] .
- 		[#monotonicForceNanosecondIncrement] -> [
- 			posixUtcValue > LastClockTick
- 				ifTrue: [LastClockTick := posixUtcValue]
- 				ifFalse: [LastClockTick := LastClockTick + (1 / 1000). "add one nanosecond"
- 					aDateAndTime utcMicroseconds: LastClockTick]]
- 	} otherwise: [].
- 	^aDateAndTime!

Item was removed:
- ----- Method: Time class>>primPosixMicrosecondClockWithOffset: (in category 'clock') -----
- primPosixMicrosecondClockWithOffset: arrayOrObjectWithTwoSlots
- 	"Answer an array with UTC microseconds since the Posix epoch and the
- 	current seconds offset from GMT in the local time zone. If the primitive is
- 	not available, then answer the time and offset of Posix epoch GMT. This enables
- 	the image to continue running in the absence of #primitiveUtcWithOffset, thus
- 	avoiding the need to fallback code based on the earlier local microsecond clock
- 	mechanism.
- 
- 	The parameter may be a two element array, or an object whose first two instance
- 	variables are expected to be UTC microseconds and seconds offset from GMT."
- 
- 	<primitive: 'primitiveUtcWithOffset'>
- 
- 	(arrayOrObjectWithTwoSlots instVarAt: 1)
- 		ifNil: [arrayOrObjectWithTwoSlots instVarAt: 1 put: 0].
- 	(arrayOrObjectWithTwoSlots instVarAt: 2)
- 		ifNil: [arrayOrObjectWithTwoSlots instVarAt: 2 put: 0]!

Item was removed:
- ----- Method: Time class>>primitiveUpdateTimeZone (in category 'clock') -----
- primitiveUpdateTimeZone
- 	"Update the VMs notion of the current time zone.  The VM sets its notion
- 	 of the time zone once at start-up.  If one wants the VM to keep its notion
- 	 up-to-date arrange to invoke this primitive periodically."
- 	
- 	<primitive: 243>
- 	^nil "Return nil instead of self to indicate that the primitive failed."!

Item was removed:
- ----- Method: Time class>>readFrom: (in category 'smalltalk-80') -----
- readFrom: aStream
- 	"Read a Time from the stream in the form:
- 		<hour>:<minute>:<second> <am/pm>
- 
- 	<minute>, <second> or <am/pm> may be omitted.  e.g. 1:59:30 pm; 8AM; 15:30"
- 
- 	| hourMinuteSecondNano |
- 	hourMinuteSecondNano := self readHourMinuteSecondNanoFrom: aStream.
- 	^ self 
- 		hour: hourMinuteSecondNano first 
- 		minute: hourMinuteSecondNano second 
- 		second: hourMinuteSecondNano third 
- 		nanoSecond: hourMinuteSecondNano fourth
- 
- 	"Time readFrom: (ReadStream on: '2:23:09 pm')"!

Item was removed:
- ----- Method: Time class>>readHourMinuteSecondNanoFrom: (in category 'smalltalk-80') -----
- readHourMinuteSecondNanoFrom: aStream
- 	"Read a Time from the stream in the form:
- 		<hour>:<minute>:<second> <am/pm>
- 
- 	<minute>, <second> or <am/pm> may be omitted.  e.g. 1:59:30 pm; 8AM; 15:30"
- 
- 	| hour minute second ampm nanos nanosBuffer |
- 	hour := Integer readFrom: aStream.
- 	minute := 0.
- 	second := 0.
- 	nanosBuffer := '000000000' copy.
- 	nanos := WriteStream on: nanosBuffer.
- 	(aStream peekFor: $:) 
- 		ifTrue: [
- 			minute := Integer readFrom: aStream.
- 			(aStream peekFor: $:) 
- 				ifTrue: [
- 					second := Integer readFrom: aStream.
- 					(aStream peekFor: $.)
- 						ifTrue: [
- 							[aStream atEnd not and: [aStream peek isDigit]]
- 								whileTrue: [nanos nextPut: aStream next]]]].
- 	aStream skipSeparators.
- 	(aStream atEnd not and: ['PApa' includes: aStream peek]) ifTrue: 
- 		[ampm := aStream next asLowercase.
- 		(ampm = $p and: [hour < 12]) ifTrue: [hour := hour + 12].
- 		(ampm = $a and: [hour = 12]) ifTrue: [hour := 0].
- 		(aStream peekFor: $m) ifFalse: [aStream peekFor: $M ]].
- 	^ { hour . minute . second . nanosBuffer asInteger }
- 
- 	"Time readFrom: (ReadStream on: '2:23:09 pm')"!

Item was removed:
- ----- Method: Time class>>seconds: (in category 'squeak protocol') -----
- seconds: seconds
- 	"Answer a Time from midnight."
- 
- 	^ self basicNew ticks: (Duration seconds: seconds) ticks!

Item was removed:
- ----- Method: Time class>>seconds:nanoSeconds: (in category 'squeak protocol') -----
- seconds: seconds nanoSeconds: nanoCount
- 	"Answer a Time from midnight."
- 
- 	^ self basicNew
- 		ticks: (Duration seconds: seconds nanoSeconds: nanoCount) ticks
- !

Item was removed:
- ----- Method: Time class>>startUp: (in category 'system startup') -----
- startUp: resuming
- 
- 	resuming ifTrue: [
- 		LastClockTick := 0 ]!

Item was removed:
- ----- Method: Time class>>totalSeconds (in category 'smalltalk-80') -----
- totalSeconds
- 	"Answer the total seconds since the Squeak epoch: 1 January 1901, in local time."
- 
- 	^self localMicrosecondClock // 1000000!

Item was removed:
- ----- Method: Time class>>updateTimeZoneCacheAt: (in category 'clock') -----
- updateTimeZoneCacheAt: posixUtcMicrosecondClock
- 	"Tell the VM to update its cached time zone value if the POSIX UTC time has reached the value stored in UpdateVMTimeZoneCacheAt. Assume that posixUtcMicrosecondClock is an integer with the current POSIX UTC microsecond clock value. Return true if the cache was updated to indicate that the time zone may have changed."
- 
- 	| updateInterval |
- 	UpdateVMTimeZoneCacheAt ifNil: [
- 		"Automatic update is disabled."
- 		^false ].
- 	posixUtcMicrosecondClock < UpdateVMTimeZoneCacheAt ifTrue: [ ^false ].
- 	self primitiveUpdateTimeZone ifNil: [ 
- 		"The primitive failed."
- 		^false ].
- 	updateInterval := 1800000000. "This could be a preference but 30 minutes works for all upcoming DST change times."
- 	UpdateVMTimeZoneCacheAt := posixUtcMicrosecondClock // updateInterval + 1 * updateInterval "Round up posixUtcMicrosecondClock to the next multiple of updateInterval.".
- 	^true!

Item was removed:
- ----- Method: Time class>>useHighResClockForTiming (in category 'preferences') -----
- useHighResClockForTiming
- 	<preference: 'Use high resolution clock for timing'
- 	category: 'performance'
- 	description: 'This is used for measuring time ellapsed for running a block. High resolution clocks (known as TSC) are counter embedded on CPU and incremented at each cycle. They enable timing close to the nanosecond for GHz CPU. However, on older models, they might have a non constant rate depending on power saving: converting ticks to seconds is not reliable in this case, but knowing the number of cycles taken to perform the task is still a valuable information. TSC might also be un-synchronized between the multi-cores: if Squeak process is switched from 1 core to another during the timing, timing results could be random. If you have a recent CPU, you might prefer this option'
- 	type: #Boolean>
- 	^UseHighResClockForTiming ifNil: [ false ]!

Item was removed:
- ----- 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."
- 	<primitive: 240>
- 	^0!

Item was removed:
- ----- Method: Time>>< (in category 'ansi protocol') -----
- < aTime
- 
- 	^ self asDuration < aTime asDuration!

Item was removed:
- ----- Method: Time>>= (in category 'ansi protocol') -----
- = aTime
- 
- 	^ [ self ticks = aTime ticks ]
- 		on: MessageNotUnderstood do: [false]!

Item was removed:
- ----- Method: Time>>addSeconds: (in category 'smalltalk-80') -----
- addSeconds: nSeconds 
- 	"Answer a Time that is nSeconds after the receiver."
- 
- 	| secondsToAdd newNanos |
- 	(secondsToAdd := nSeconds truncated) = nSeconds
- 		ifTrue: [newNanos := nanos]
- 		ifFalse: [(newNanos := nanos + (nSeconds - secondsToAdd * NanosInSecond)) > NanosInSecond
- 				ifTrue: [secondsToAdd := secondsToAdd + 1.
- 					newNanos := newNanos - NanosInSecond]].
- 	^ self class seconds: seconds + secondsToAdd nanoSeconds: newNanos!

Item was removed:
- ----- Method: Time>>addTime: (in category 'smalltalk-80') -----
- addTime: timeAmount
- 	"Answer a Time that is timeInterval after the receiver. timeInterval is an 
- 	instance of Date or Time."
- 
- 	^ self class seconds: self asSeconds + timeAmount asSeconds
- !

Item was removed:
- ----- Method: Time>>asDate (in category 'squeak protocol') -----
- asDate
- 
- 	^ Date today!

Item was removed:
- ----- Method: Time>>asDateAndTime (in category 'squeak protocol') -----
- asDateAndTime
- 
- 	^ DateAndTime today + self!

Item was removed:
- ----- Method: Time>>asDuration (in category 'squeak protocol') -----
- asDuration
- 
- 	"Answer the duration since midnight"
- 
- 	^ Duration seconds: seconds nanoSeconds: nanos!

Item was removed:
- ----- Method: Time>>asMonth (in category 'squeak protocol') -----
- asMonth
- 
- 	^ self asDateAndTime asMonth!

Item was removed:
- ----- Method: Time>>asNanoSeconds (in category 'squeak protocol') -----
- asNanoSeconds
- 	"Answer the number of nanoseconds since midnight"
- 
- 	^ self asDuration asNanoSeconds!

Item was removed:
- ----- Method: Time>>asSeconds (in category 'smalltalk-80') -----
- asSeconds
- 	"Answer the number of seconds since midnight of the receiver."
- 
- 	^ seconds
- !

Item was removed:
- ----- Method: Time>>asTime (in category 'squeak protocol') -----
- asTime
- 
- 	^ self!

Item was removed:
- ----- Method: Time>>asTimeStamp (in category 'squeak protocol') -----
- asTimeStamp
- 
- 	^ self asDateAndTime asTimeStamp!

Item was removed:
- ----- Method: Time>>asWeek (in category 'squeak protocol') -----
- asWeek
- 
- 	^ self asDateAndTime asWeek!

Item was removed:
- ----- Method: Time>>asYear (in category 'squeak protocol') -----
- asYear
- 
- 	^ self asDateAndTime asYear!

Item was removed:
- ----- Method: Time>>duration (in category 'ansi protocol') -----
- duration
- 
- 	^ Duration zero!

Item was removed:
- ----- Method: Time>>hash (in category 'ansi protocol') -----
- hash
- 
- 	^ self ticks hash!

Item was removed:
- ----- Method: Time>>hhmm24 (in category 'printing') -----
- hhmm24
- 	"Return a string of the form 1123 (for 11:23 am), 2154 (for 9:54 pm), of exactly 4 digits"
- 
- 	^(String streamContents: 
- 		[ :aStream | self print24: true showSeconds: false on: aStream ])
- 			copyWithout: $:
- !

Item was removed:
- ----- Method: Time>>hour (in category 'ansi protocol') -----
- hour
- 
- 	^ self hour24!

Item was removed:
- ----- Method: Time>>hour12 (in category 'ansi protocol') -----
- hour12
- 	"Answer an <integer> between 1 and 12, inclusive, representing the hour 
- 	of the day in the 12-hour clock of the local time of the receiver."
- 	^ self hour24 - 1 \\ 12 + 1
- !

Item was removed:
- ----- Method: Time>>hour24 (in category 'ansi protocol') -----
- hour24
- 
- 
- 	^ self asDuration hours!

Item was removed:
- ----- Method: Time>>hours (in category 'smalltalk-80') -----
- hours
- 
- 	^ self hour!

Item was removed:
- ----- Method: Time>>intervalString (in category 'smalltalk-80') -----
- intervalString
- 	"Treat the time as a difference.  Give it in hours and minutes with two digits of accuracy."
- 
- 	| d |
- 	d := self asDuration.
- 	^ String streamContents: [ :s |
- 		d hours > 0 ifTrue: [s print: d hours; nextPutAll: ' hours'].
- 		d minutes > 0 ifTrue: [s space; print: d minutes; nextPutAll: ' minutes'].
- 		d seconds > 0 ifTrue: [s space; print: d seconds; nextPutAll: ' seconds'] ]
- !

Item was removed:
- ----- Method: Time>>meridianAbbreviation (in category 'ansi protocol') -----
- meridianAbbreviation
- 
- 	^ self hour < 12 ifTrue: ['AM'] ifFalse: ['PM']
- !

Item was removed:
- ----- Method: Time>>minute (in category 'ansi protocol') -----
- minute
- 
- 	^ self asDuration minutes!

Item was removed:
- ----- Method: Time>>minutes (in category 'smalltalk-80') -----
- minutes
- 
- 	^ self asDuration minutes!

Item was removed:
- ----- Method: Time>>nanoSecond (in category 'squeak protocol') -----
- nanoSecond
- 
- 
- 	^ nanos!

Item was removed:
- ----- Method: Time>>print24 (in category 'printing') -----
- print24
- 	"Return as 8-digit string 'hh:mm:ss', with leading zeros if needed"
- 
- 	^String streamContents:
- 		[ :aStream | self print24: true on: aStream ]
- !

Item was removed:
- ----- Method: Time>>print24:on: (in category 'printing') -----
- print24: hr24 on: aStream 
- 	"Format is 'hh:mm:ss' or 'h:mm:ss am' "
- 
- 	self print24: hr24 showSeconds: true on: aStream!

Item was removed:
- ----- Method: Time>>print24:showSeconds:on: (in category 'printing') -----
- print24: hr24 showSeconds: showSeconds on: aStream 
- 	"Format is 'hh:mm:ss' or 'h:mm:ss am'  or, if showSeconds is false, 'hh:mm' or 'h:mm am'"
- 
- 	^self print24: hr24 showSeconds: showSeconds showSubseconds: false on: aStream !

Item was removed:
- ----- Method: Time>>print24:showSeconds:showSubseconds:on: (in category 'printing') -----
- print24: hr24 showSeconds: showSeconds showSubseconds: showSubseconds on: aStream 
- 	"Format is 'hh:mm:ss' or 'h:mm:ss am'  or, if showSeconds is false, 'hh:mm' or 'h:mm am'.
- 	If showSubseconds is true and our nanoSeconds are not zero, a decimal point and subseconds are added"
- 
- 	| h m s |
- 	h := self hour. m := self minute. s := self second.
- 	hr24
- 		ifTrue: 
- 			[ h < 10 ifTrue: [ aStream nextPutAll: '0' ].
- 			h printOn: aStream ]
- 		ifFalse:
- 			[ h > 12
- 				ifTrue: [h - 12 printOn: aStream]
- 				ifFalse: 
- 					[h < 1
- 						ifTrue: [ 12 printOn: aStream ]
- 						ifFalse: [ h printOn: aStream ]]].
- 
- 	aStream nextPutAll: (m < 10 ifTrue: [':0'] ifFalse: [':']).
- 	m printOn: aStream.
- 
- 	showSeconds ifTrue:
- 		[ aStream nextPutAll: (s < 10 ifTrue: [':0'] ifFalse: [':']).
- 		(showSubseconds not or: [self nanoSecond = 0])
- 			ifTrue: [s asInteger printOn: aStream]
- 			ifFalse: [s asInteger * NanosInSecond + self nanoSecond asInteger 
- 				printOn: aStream asFixedPoint: NanosInSecond]].
- 
- 	hr24 ifFalse:
- 		[ aStream nextPutAll: (h < 12 ifTrue: [' am'] ifFalse: [' pm']) ].
- !

Item was removed:
- ----- Method: Time>>printMinutes (in category 'printing') -----
- printMinutes
- 	"Return as string 'hh:mm pm'  "
- 
- 	^String streamContents:
- 		[ :aStream | self print24: false showSeconds: false on: aStream ]!

Item was removed:
- ----- Method: Time>>printOn: (in category 'printing') -----
- printOn: aStream 
- 
- 	self print24: false
- 		showSeconds: (self seconds ~= 0
- 				or: [self nanoSecond ~= 0])
- 		showSubseconds: self nanoSecond ~= 0
- 		on: aStream!

Item was removed:
- ----- Method: Time>>second (in category 'ansi protocol') -----
- second
- 
- 
- 	^ self asDuration seconds
- !

Item was removed:
- ----- Method: Time>>seconds (in category 'smalltalk-80') -----
- seconds
- 
- 	^ self second!

Item was removed:
- ----- Method: Time>>seconds: (in category 'private') -----
- seconds: secondCount
- 	"Private - only used by Time class."
- 
- 	seconds := secondCount.
- 	nanos := 0
- !

Item was removed:
- ----- Method: Time>>seconds:nanoSeconds: (in category 'private') -----
- seconds: secondCount nanoSeconds: nanoCount 
- 	"Private - only used by Time class."
- 
- 	seconds := secondCount.
- 	nanos := nanoCount
- !

Item was removed:
- ----- Method: Time>>storeOn: (in category 'printing') -----
- storeOn: aStream
- 
- 	aStream print: self printString; nextPutAll: ' asTime'
- !

Item was removed:
- ----- Method: Time>>subtractTime: (in category 'smalltalk-80') -----
- subtractTime: timeAmount 
- 	"Answer a Time that is timeInterval before the receiver. timeInterval is  
- 	an instance of Date or Time."
- 
- 	^ self class seconds: self asSeconds - timeAmount asSeconds!

Item was removed:
- ----- Method: Time>>ticks (in category 'private') -----
- ticks
- 	"Answer an Array: { seconds. nanoSeconds }"
- 
- 	^ Array with: 0 with: seconds with: nanos.!

Item was removed:
- ----- Method: Time>>ticks: (in category 'private') -----
- ticks: anArray
- 	"ticks is an Array: { days. seconds. nanoSeconds }"
- 
- 	seconds := anArray at: 2.
- 	nanos := anArray at: 3
- !

Item was removed:
- ----- Method: Time>>to: (in category 'squeak protocol') -----
- to: anEnd
- 	"Answer a Timespan. anEnd must respond to #asDateAndTime"
- 
- 	^ self asDateAndTime to: anEnd!

Item was removed:
- DateAndTime subclass: #TimeStamp
- 	instanceVariableNames: ''
- 	classVariableNames: ''
- 	poolDictionaries: ''
- 	category: 'Chronology-Core'!
- 
- !TimeStamp commentStamp: '<historical>' prior: 0!
- This represents a duration of 0 length that marks a particular point in time.!

Item was removed:
- ----- Method: TimeStamp class>>current (in category 'squeak protocol') -----
- current
- 
- 	^self now!

Item was removed:
- ----- Method: TimeStamp>>asDateAndTime (in category 'squeak protocol') -----
- asDateAndTime
- 	"Answer the receiver as an instance of DateAndTime."
- 
- 	^ DateAndTime utcMicroseconds: utcMicroseconds offset: localOffsetSeconds!

Item was removed:
- ----- Method: TimeStamp>>asTimeStamp (in category 'squeak protocol') -----
- asTimeStamp
- 	"Answer the receiver as an instance of TimeStamp."
- 
- 	^ self!

Item was removed:
- ----- Method: TimeStamp>>date (in category 'squeak protocol') -----
- date
- 	"Answer the date of the receiver."
- 
- 	^ self asDate!

Item was removed:
- ----- Method: TimeStamp>>dateAndTime (in category 'squeak protocol') -----
- dateAndTime
- 	"Answer a two element Array containing the receiver's date and time."
- 
- 	^ Array with: self date with: self time!

Item was removed:
- ----- Method: TimeStamp>>minusDays: (in category 'squeak protocol') -----
- minusDays: anInteger
- 	"Answer a TimeStamp which is anInteger days before the receiver."
- 
- 	^ self - (anInteger days)!

Item was removed:
- ----- Method: TimeStamp>>minusSeconds: (in category 'squeak protocol') -----
- minusSeconds: anInteger
- 	"Answer a TimeStamp which is anInteger number of seconds before the receiver."
- 
- 	^ self - (anInteger seconds)!

Item was removed:
- ----- Method: TimeStamp>>plusDays: (in category 'squeak protocol') -----
- plusDays: anInteger
- 	"Answer a TimeStamp which is anInteger days after the receiver."
- 
- 	^ self + (anInteger days)!

Item was removed:
- ----- Method: TimeStamp>>plusSeconds: (in category 'squeak protocol') -----
- plusSeconds: anInteger
- 	"Answer a TimeStamp which is anInteger number of seconds after the receiver."
- 
- 	^ self + (anInteger seconds)!

Item was removed:
- ----- Method: TimeStamp>>printOn: (in category 'squeak protocol') -----
- printOn: aStream 
- 	"Print receiver's date and time on aStream."
- 
- 	aStream 
- 		nextPutAll: self date printString;
- 		space;
- 		nextPutAll: self time printString.!

Item was removed:
- ----- Method: TimeStamp>>storeOn: (in category 'squeak protocol') -----
- storeOn: aStream 
- 
- 	aStream 
- 		print: self printString;
- 		nextPutAll: ' asTimeStamp'!

Item was removed:
- ----- Method: TimeStamp>>time (in category 'squeak protocol') -----
- time
- 	"Answer the time of the receiver."
- 
- 	^ self asTime!

Item was removed:
- Object subclass: #TimeZone
- 	instanceVariableNames: 'offset abbreviation name'
- 	classVariableNames: ''
- 	poolDictionaries: 'ChronologyConstants'
- 	category: 'Chronology-Core'!
- 
- !TimeZone commentStamp: 'dtl 7/11/2009 15:03' prior: 0!
- TimeZone is a simple class to colect the information identifying a UTC time zone.
- 
- offset			-	Duration	- the time zone's offset from UTC
- abbreviation	-	String		- the abbreviated name for the time zone.
- name			-	String		- the name of the time zone.
- 
- TimeZone class >> #timeZones returns an array of the known time zones
- TimeZone class >> #default returns the default time zone (Grenwich Mean Time)
- !

Item was removed:
- ----- Method: TimeZone class>>default (in category 'accessing') -----
- default
- 	"Answer the default time zone - GMT"
- 
- 	^ self timeZones detect: [ :tz | tz offset = Duration zero ]!

Item was removed:
- ----- Method: TimeZone class>>offset:name:abbreviation: (in category 'instance creation') -----
- offset: aDuration name: aName abbreviation: anAbbreviation
- 
- 	^ self new
- 		offset: aDuration;
- 		name: aName;
- 		abbreviation: anAbbreviation;
- 		yourself
- !

Item was removed:
- ----- Method: TimeZone class>>timeZones (in category 'accessing') -----
- timeZones
- 	^{
- 		self offset:  0 hours name: 'Universal Time' abbreviation: 'UTC'.
- 		self offset:  0 hours name: 'Greenwich Mean Time' abbreviation: 'GMT'.
- 		self offset:  1 hours name: 'Central European Time' abbreviation: 'CET'.
- 		self offset:  2 hours name: 'South African Standard Time' abbreviation: 'SAST'.
- 		self offset: -8 hours name: 'Pacific Standard Time' abbreviation: 'PST'.
- 		self offset: -7 hours name: 'Mountain Standard Time' abbreviation: 'MST'.
- 		self offset: -6 hours name: 'Central Standard Time' abbreviation: 'CST'.
- 		self offset: -5 hours name: 'Eastern Standard Time' abbreviation: 'EST'.
- 	}!

Item was removed:
- ----- Method: TimeZone class>>timeZonesDST (in category 'accessing') -----
- timeZonesDST
- 	^{
- 		self offset:  1 hours name: 'British Summer Time' abbreviation: 'BST'.
- 		self offset:  2 hours name: 'Central European Summer Time' abbreviation: 'CEST'.
- 		self offset: -7 hours name: 'Pacific Daylight Time' abbreviation: 'PDT'.
- 		self offset: -6 hours name: 'Mountain Daylight Time' abbreviation: 'MDT'.
- 		self offset: -5 hours name: 'Central Daylight Time' abbreviation: 'CDT'.
- 		self offset: -4 hours name: 'Eastern Daylight Time' abbreviation: 'EDT'.
- 	}!

Item was removed:
- ----- Method: TimeZone>>abbreviation (in category 'accessing') -----
- abbreviation
- 
- 	^ abbreviation!

Item was removed:
- ----- Method: TimeZone>>abbreviation: (in category 'accessing') -----
- abbreviation: aString
- 
- 	abbreviation := aString!

Item was removed:
- ----- Method: TimeZone>>name (in category 'accessing') -----
- name
- 
- 	^ name!

Item was removed:
- ----- Method: TimeZone>>name: (in category 'accessing') -----
- name: aString
- 
- 	name := aString!

Item was removed:
- ----- Method: TimeZone>>offset (in category 'accessing') -----
- offset
- 
- 	^ offset
- !

Item was removed:
- ----- Method: TimeZone>>offset: (in category 'accessing') -----
- offset: aDuration
- 
- 	offset := aDuration
- !

Item was removed:
- ----- Method: TimeZone>>printOn: (in category 'private') -----
- printOn: aStream
- 
- 	super printOn: aStream.
- 	aStream
- 		nextPut: $(;
- 		nextPutAll: self abbreviation;
- 		nextPut: $)!

Item was removed:
- Magnitude subclass: #Timespan
- 	instanceVariableNames: 'start duration'
- 	classVariableNames: ''
- 	poolDictionaries: ''
- 	category: 'Chronology-Core'!
- 
- !Timespan commentStamp: 'bf 2/18/2016 14:43' prior: 0!
- I represent a duration starting on a specific DateAndTime.
- 
- If my start has an offset identical to my #defaultOffset then comparisons ignore timezone offset.!

Item was removed:
- ----- Method: Timespan class>>current (in category 'squeak protocol') -----
- current
- 	^ self starting: (DateAndTime now offset: self defaultOffset)!

Item was removed:
- ----- Method: Timespan class>>defaultOffset (in category 'configuring') -----
- defaultOffset
- 	"Timespans created in the context of an offset will start in that offset.  When no context is available, the defaultOffset for Timespans must be zero.  For example, two ways to make a Date for today:
- 	Date today.  'start is midnight at offset zero.  Will compare successfully to other Date today results.'
- 	DateAndTime now asDate.  'In this case, the start is midnight of the local time-zone.  It can only compare equally to Dates of its time-zone.'"
- 	^ Duration zero!

Item was removed:
- ----- Method: Timespan class>>new (in category 'squeak protocol') -----
- new
- 	"Answer a Timespan starting on the Squeak epoch: 1 January 1901"
- 	^ self starting: (DateAndTime new offset: self defaultOffset)!

Item was removed:
- ----- Method: Timespan class>>starting: (in category 'squeak protocol') -----
- starting: aDateAndTime
- 
- 
- 	^ self starting: aDateAndTime duration: Duration zero!

Item was removed:
- ----- Method: Timespan class>>starting:duration: (in category 'squeak protocol') -----
- starting: aDateAndTime duration: aDuration
- 
- 	^ self basicNew
-  		start: aDateAndTime asDateAndTime;
- 		duration: aDuration;
- 		yourself!

Item was removed:
- ----- Method: Timespan class>>starting:ending: (in category 'squeak protocol') -----
- starting: startDateAndTime ending: endDateAndTime
- 
- 	^ self 
- 		starting: startDateAndTime 
- 		duration: (endDateAndTime asDateAndTime - startDateAndTime)
- !

Item was removed:
- ----- Method: Timespan>>+ (in category 'ansi protocol') -----
- + operand
- 	"operand conforms to protocol Duration"
- 	
- 
- 	^ self class starting: (self start + operand) duration: self duration!

Item was removed:
- ----- Method: Timespan>>- (in category 'ansi protocol') -----
- - operand
- 	"operand conforms to protocol DateAndTime or protocol Duration"
- 
- 	^ (operand respondsTo: #asDateAndTime)
- 
- 	 	ifTrue: [ self start - operand ]
- 	
- 	ifFalse: [ self + (operand negated) ]
- !

Item was removed:
- ----- Method: Timespan>>< (in category 'ansi protocol') -----
- < comparand
- 
- 	^ self start < comparand!

Item was removed:
- ----- Method: Timespan>>= (in category 'ansi protocol') -----
- = comparand
- 	^ self class = comparand class 
- 		and: [ self start = comparand start
- 		and: [ self duration = comparand duration ] ]
- .!

Item was removed:
- ----- Method: Timespan>>asDate (in category 'squeak protocol') -----
- asDate
- 
- 
- 	^ start asDate!

Item was removed:
- ----- Method: Timespan>>asDateAndTime (in category 'squeak protocol') -----
- asDateAndTime
- 
- 	^ start!

Item was removed:
- ----- Method: Timespan>>asDuration (in category 'squeak protocol') -----
- asDuration
- 
- 	^ self duration!

Item was removed:
- ----- Method: Timespan>>asMonth (in category 'squeak protocol') -----
- asMonth
- 
- 
- 	^ start asMonth!

Item was removed:
- ----- Method: Timespan>>asTime (in category 'squeak protocol') -----
- asTime
- 
- 	^ start asTime!

Item was removed:
- ----- Method: Timespan>>asTimeStamp (in category 'squeak protocol') -----
- asTimeStamp
- 
- 	^ start asTimeStamp!

Item was removed:
- ----- Method: Timespan>>asWeek (in category 'squeak protocol') -----
- asWeek
- 
- 	^ start asWeek!

Item was removed:
- ----- Method: Timespan>>asYear (in category 'squeak protocol') -----
- asYear
- 
- 
- 	^ start asYear
- !

Item was removed:
- ----- Method: Timespan>>beCanonical (in category 'squeak protocol') -----
- beCanonical
- 	"Chronology preserves Timespans that are extracted from DateAndTime's, making Dates, Months and Years in Squeak able to represent a true Timespan of those durations starting at a specific local DateAndTime.  In case a canonical version is needed, make the receiver independent of any Timezone by removing it."
- 	start makeUTC!

Item was removed:
- ----- Method: Timespan>>dates (in category 'enumerating') -----
- dates
- 
- 
- 	| dates |
- 
- 	dates := OrderedCollection new.
- 	self datesDo: [ :m | dates add: m ].
- 	^ dates asArray!

Item was removed:
- ----- Method: Timespan>>datesDo: (in category 'enumerating') -----
- datesDo: aBlock
- 
- 
- 	self do: aBlock with: start asDate
- !

Item was removed:
- ----- Method: Timespan>>day (in category 'smalltalk-80') -----
- day
- 	"Answer the day of the year represented by the receiver."
- 	^ self dayOfYear!

Item was removed:
- ----- Method: Timespan>>dayOfLocalWeek (in category 'ansi protocol') -----
- dayOfLocalWeek
- 	"Answer the day of the week represented by the receiver."
- 
- 	^ start dayOfLocalWeek!

Item was removed:
- ----- Method: Timespan>>dayOfMonth (in category 'ansi protocol') -----
- dayOfMonth
- 	"Answer the day of the month represented by the receiver."
- 
- 	^ start dayOfMonth!

Item was removed:
- ----- Method: Timespan>>dayOfWeek (in category 'ansi protocol') -----
- dayOfWeek
- 	"Answer the day of the week represented by the receiver."
- 
- 	^ start dayOfWeek!

Item was removed:
- ----- Method: Timespan>>dayOfWeekName (in category 'ansi protocol') -----
- dayOfWeekName
- 	"Answer the day of the week represented by the receiver."
- 
- 	^ start dayOfWeekName!

Item was removed:
- ----- Method: Timespan>>dayOfYear (in category 'ansi protocol') -----
- dayOfYear
- 	"Answer the day of the year represented by the receiver."
- 
- 	^ start dayOfYear!

Item was removed:
- ----- Method: Timespan>>daysInMonth (in category 'smalltalk-80') -----
- daysInMonth
- 
- 
- 	^ start daysInMonth!

Item was removed:
- ----- Method: Timespan>>daysInYear (in category 'smalltalk-80') -----
- daysInYear
- 	"Answer the number of days in the month represented by the receiver."
- 
- 	^ start daysInYear!

Item was removed:
- ----- Method: Timespan>>daysLeftInYear (in category 'smalltalk-80') -----
- daysLeftInYear
- 	^ start daysLeftInYear!

Item was removed:
- ----- Method: Timespan>>do:with: (in category 'private') -----
- do: aBlock with: aFirstElement
- 
- 	self do: aBlock with: aFirstElement when: [ :t | true ]
- !

Item was removed:
- ----- Method: Timespan>>do:with:when: (in category 'private') -----
- do: aBlock with: aFirstElement when: aConditionBlock
- 
- 	| element end |
- 	element := aFirstElement.
- 	end := self end.
- 	[ element start <= end ] whileTrue:
- 	
- 	[(aConditionBlock value: element)
- 			ifTrue: [ aBlock value: element ].
- 		element := element next. ]
- !

Item was removed:
- ----- Method: Timespan>>duration (in category 'squeak protocol') -----
- duration
- 	"Answer the Duration of this timespan"
- 
- 	^ duration!

Item was removed:
- ----- Method: Timespan>>duration: (in category 'private') -----
- duration: aDuration
- 	"Set the Duration of this timespan"
- 
- 	duration := aDuration!

Item was removed:
- ----- Method: Timespan>>end (in category 'squeak protocol') -----
- end
- 
- 
- 	^ self duration asNanoSeconds = 0
- 		ifTrue: [ self start ]
- 		ifFalse: [ self next start - DateAndTime clockPrecision ]
- !

Item was removed:
- ----- Method: Timespan>>every:do: (in category 'enumerating') -----
- every: aDuration do: aBlock
- 
- 	| element end |
- 	element := self start.
- 	end := self end.
- 	[ element <= end ] whileTrue:
- 	
- 	[ aBlock value: element.
- 		element := element + aDuration. ]!

Item was removed:
- ----- Method: Timespan>>firstDayOfMonth (in category 'smalltalk-80') -----
- firstDayOfMonth
- 
- 	^ start firstDayOfMonth!

Item was removed:
- ----- Method: Timespan>>hash (in category 'ansi protocol') -----
- hash
- 
- 	^ start hash + duration hash!

Item was removed:
- ----- Method: Timespan>>includes: (in category 'squeak protocol') -----
- includes: aDateAndTime
- 
- 
- 	^ (aDateAndTime isKindOf: Timespan)
- 			ifTrue: [ (self includes: aDateAndTime start)
- 						and: [ self includes: aDateAndTime end ] ]
- 			ifFalse: [ aDateAndTime asDateAndTime between: start and: self end ]!

Item was removed:
- ----- Method: Timespan>>includesAllOf: (in category 'squeak protocol') -----
- includesAllOf: aCollection 
- 	"Answer whether all the elements of aCollection are in the receiver."
- 
- 	aCollection do: [:elem | (self includes: elem) ifFalse: [^ false]].
- 	^ true
- !

Item was removed:
- ----- Method: Timespan>>includesAnyOf: (in category 'squeak protocol') -----
- includesAnyOf: aCollection 
- 	"Answer whether any element of aCollection is included in the receiver"
- 
- 	aCollection do: [ :elem | (self includes: elem) ifTrue: [^ true]].
- 	^false
- !

Item was removed:
- ----- Method: Timespan>>intersection: (in category 'squeak protocol') -----
- intersection: aTimespan
- 
- 	 "Return the Timespan both have in common, or nil"
- 
- 	 | aBegin anEnd |
- 	 aBegin := self start max: aTimespan start.
- 	 anEnd := self end min: aTimespan end.
- 	 anEnd < aBegin ifTrue: [^nil].
- 
- 	 ^ self class starting: aBegin ending: anEnd
- !

Item was removed:
- ----- Method: Timespan>>isLeapYear (in category 'ansi protocol') -----
- isLeapYear
- 
- 	^ start isLeapYear!

Item was removed:
- ----- Method: Timespan>>julianDayNumber (in category 'squeak protocol') -----
- julianDayNumber
- 
- 
- 	^ start julianDayNumber!

Item was removed:
- ----- Method: Timespan>>makeUTC (in category 'squeak protocol') -----
- makeUTC
- 	"Change the receiver's timezone to UTC, which affords substantially better hashing performance."
- 	start makeUTC!

Item was removed:
- ----- Method: Timespan>>month (in category 'ansi protocol') -----
- month
- 
- 	^ start month!

Item was removed:
- ----- Method: Timespan>>monthAbbreviation (in category 'ansi protocol') -----
- monthAbbreviation
- 
- 
- 	^ start monthAbbreviation!

Item was removed:
- ----- Method: Timespan>>monthIndex (in category 'smalltalk-80') -----
- monthIndex
- 
- 	^ self month!

Item was removed:
- ----- Method: Timespan>>monthName (in category 'ansi protocol') -----
- monthName
- 
- 
- 	^ start monthName!

Item was removed:
- ----- Method: Timespan>>months (in category 'enumerating') -----
- months
- 
- 	| months |
- 	months := OrderedCollection new: 12.
- 	self monthsDo: [ :m | months add: m ].
- 	^ months asArray.
- !

Item was removed:
- ----- Method: Timespan>>monthsDo: (in category 'enumerating') -----
- monthsDo: aBlock
- 
- 	self do: aBlock with: start asMonth!

Item was removed:
- ----- Method: Timespan>>next (in category 'smalltalk-80') -----
- next
- 
- 	^ self class starting: (start + duration) duration: duration!

Item was removed:
- ----- Method: Timespan>>previous (in category 'smalltalk-80') -----
- previous
- 
- 
- 	^ self class starting: (start - duration) duration: duration!

Item was removed:
- ----- Method: Timespan>>printOn: (in category 'squeak protocol') -----
- printOn: aStream
- 
- 
- 	super printOn: aStream.
- 	aStream 
- 		nextPut: $(;
- 		print: start;
- 		nextPut: $D;
- 		print: duration;
- 		nextPut: $)
- !

Item was removed:
- ----- Method: Timespan>>start (in category 'squeak protocol') -----
- start
- 	"Answer the start DateAndTime of this timespan"
- 
- 	^ start!

Item was removed:
- ----- Method: Timespan>>start: (in category 'squeak protocol') -----
- start: aDateAndTime
- 	"Store the start DateAndTime of this timespan"
- 
- 	start := aDateAndTime asDateAndTime!

Item was removed:
- ----- Method: Timespan>>to: (in category 'squeak protocol') -----
- to: anEnd
- 	"Answer an Timespan. anEnd must be aDateAndTime or a Timespan"
- 
- 
- 	^ Timespan starting: (self start) ending: (anEnd asDateAndTime)
- !

Item was removed:
- ----- Method: Timespan>>union: (in category 'squeak protocol') -----
- union: aTimespan
- 	 "Return the Timespan spanned by both"
- 
- 	| aBegin anEnd |
- 
- 	aBegin := self start min: aTimespan start.
- 	anEnd := self end max: aTimespan end.
- 	^ Timespan starting: aBegin ending: (anEnd + DateAndTime clockPrecision)
- !

Item was removed:
- ----- Method: Timespan>>weeks (in category 'enumerating') -----
- weeks
- 
- 
- 	| weeks |
- 	weeks := OrderedCollection new.
- 	self weeksDo: [ :m | weeks add: m ].
- 	^ weeks asArray!

Item was removed:
- ----- Method: Timespan>>weeksDo: (in category 'enumerating') -----
- weeksDo: aBlock
- 
- 	self do: aBlock with: self asWeek.!

Item was removed:
- ----- Method: Timespan>>workDatesDo: (in category 'enumerating') -----
- workDatesDo: aBlock
- 	"Exclude Saturday and Sunday"
- 
- 	self do: aBlock with: start asDate when: [ :d | d dayOfWeek < 6 ]
- !

Item was removed:
- ----- Method: Timespan>>year (in category 'ansi protocol') -----
- year
- 
- 
- 	^ start year!

Item was removed:
- ----- Method: Timespan>>years (in category 'enumerating') -----
- years
- 
- 
- 	| years |
- 	years := OrderedCollection new.
- 	self yearsDo: [ :m | years add: m ].
- 	^ years asArray!

Item was removed:
- ----- Method: Timespan>>yearsDo: (in category 'enumerating') -----
- yearsDo: aBlock
- 
- 	self do: aBlock with: start asYear.!

Item was removed:
- Timespan subclass: #Week
- 	instanceVariableNames: ''
- 	classVariableNames: 'StartDay'
- 	poolDictionaries: 'ChronologyConstants'
- 	category: 'Chronology-Core'!
- 
- !Week commentStamp: 'cbr 7/28/2010 18:11' prior: 0!
- I represent a week.
- 
- To find out what days of the week on which Squeak is fun, select the following expression, and print it:
- 
- Week dayNames!

Item was removed:
- ----- Method: Week class>>dayNames (in category 'squeak protocol') -----
- dayNames
- 
- 	^ DayNames!

Item was removed:
- ----- Method: Week class>>indexOfDay: (in category 'squeak protocol') -----
- indexOfDay: aSymbol
- 
- 	^ DayNames indexOf: aSymbol!

Item was removed:
- ----- Method: Week class>>nameOfDay: (in category 'smalltalk-80') -----
- nameOfDay: anIndex
- 
- 	^ DayNames at: anIndex!

Item was removed:
- ----- Method: Week class>>startDay (in category 'squeak protocol') -----
- startDay
- 
- 	^ StartDay ifNil: [ StartDay
-  := DayNames first ]
- !

Item was removed:
- ----- Method: Week class>>startDay: (in category 'squeak protocol') -----
- startDay: aSymbol
- 
- 	(DayNames includes: aSymbol)
- 		ifTrue: [ StartDay := aSymbol ]
- 		ifFalse: [ self error: aSymbol, ' is not a recognised day name' ]!

Item was removed:
- ----- Method: Week class>>starting:duration: (in category 'squeak protocol') -----
- starting: aDateAndTime duration: aDuration
- 	"Override - the duration is always one week.
- 	 Week will start from the Week class>>startDay"
- 
- 	| midnight delta adjusted |
- 	midnight := aDateAndTime asDateAndTime midnight.
- 	delta := ((midnight dayOfWeek + 7 - (DayNames indexOf: self startDay)) rem: 7) abs.
- 	adjusted := midnight - (Duration days: delta seconds: 0).
- 
- 	^ super starting: adjusted duration: (Duration weeks: 1)!

Item was removed:
- ----- Method: Week class>>weekdayStartIndex (in category 'squeak protocol') -----
- weekdayStartIndex
- 	^self indexOfDay: self startDay!

Item was removed:
- ----- Method: Week>>asWeek (in category 'squeak protocol') -----
- asWeek
- 
- 	^ self!

Item was removed:
- ----- Method: Week>>index (in category 'squeak protocol') -----
- index
- 
- 	^ self asMonth dayOfWeek + self dayOfMonth - 2  // 7 + 1
- !

Item was removed:
- ----- Method: Week>>printOn: (in category 'squeak protocol') -----
- printOn: aStream
- 
- 	aStream nextPutAll: 'a Week starting: '.
- 	self start printOn: aStream
- !

Item was removed:
- Timespan subclass: #Year
- 	instanceVariableNames: ''
- 	classVariableNames: ''
- 	poolDictionaries: ''
- 	category: 'Chronology-Core'!
- 
- !Year commentStamp: 'cbr 7/28/2010 18:10' prior: 0!
- I represent a year.
- 
- Try me!! Select the following expression and print it:
- 
- Year current daysInYear "Try me again next leap year!!"!

Item was removed:
- ----- Method: Year class>>current (in category 'squeak protocol') -----
- current
-  
- 	^ self year: (DateAndTime now year)
- !

Item was removed:
- ----- Method: Year class>>daysInYear: (in category 'smalltalk-80') -----
- daysInYear: yearInteger
- 
- 	^ 365 + ((self isLeapYear: yearInteger) ifTrue: [1] ifFalse: [0]).
- !

Item was removed:
- ----- Method: Year class>>isLeapYear: (in category 'squeak protocol') -----
- isLeapYear: aYearInteger
- 
- 
- 	| adjustedYear |
- 	adjustedYear := aYearInteger > 0
- 		ifTrue: [aYearInteger]
- 		ifFalse: [(aYearInteger + 1) negated].
- 
- 	"There was no year 0"
- 	^ ((adjustedYear \\ 4 ~= 0) or: [(adjustedYear \\ 100 = 0) and: [adjustedYear \\ 400 ~= 0]]) not!

Item was removed:
- ----- Method: Year class>>leapYear: (in category 'smalltalk-80') -----
- leapYear: yearInteger 
- 
- 	^ (self isLeapYear: yearInteger)
- 		ifTrue: [1]
- 		ifFalse: [0]!

Item was removed:
- ----- Method: Year class>>starting:duration: (in category 'squeak protocol') -----
- starting: aDateAndTime duration: aDuration 
- 	"Override - start from midnight"
- 	| midnight |
- 	midnight := aDateAndTime asDateAndTime midnight.
- 
- 	^ super
- 		starting: midnight
- 		duration: (Duration days: (self daysInYear: midnight year))!

Item was removed:
- ----- Method: Year class>>year: (in category 'squeak protocol') -----
- year: aYear 
- 	^ self starting:
- 		(DateAndTime
- 			year: aYear
- 			month: 1
- 			day: 1
- 			hour: 0
- 			minute: 0
- 			second: 0
- 			offset: self defaultOffset)!

Item was removed:
- ----- Method: Year>>asYear (in category 'squeak protocol') -----
- asYear
- 
- 
- 	^ self!

Item was removed:
- ----- Method: Year>>daysInMonth (in category 'squeak protocol') -----
- daysInMonth
- 
- 
- 	self shouldNotImplement!

Item was removed:
- ----- Method: Year>>daysInYear (in category 'squeak protocol') -----
- daysInYear
- 
- 	^ self duration days.!

Item was removed:
- ----- Method: Year>>previous (in category 'smalltalk-80') -----
- previous
- 	"This implementation handles leap years correctly"
- 	
- 	^ self class year: (self year - 1)!

Item was removed:
- ----- Method: Year>>printOn: (in category 'squeak protocol') -----
- printOn: aStream
- 
- 	aStream nextPutAll: 'a Year ('.
- 	self start year printOn: aStream.
- 
- 	aStream nextPutAll: ')'
- !

Item was removed:
- (PackageInfo named: 'Chronology-Core') postscript: 'Smalltalk removeFromStartUpList: DateAndTime'!



More information about the Squeak-dev mailing list