[squeak-dev] The Trunk: Kernel-ar.271.mcz

commits at source.squeak.org commits at source.squeak.org
Thu Oct 15 03:50:26 UTC 2009


Andreas Raab uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-ar.271.mcz

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

Name: Kernel-ar.271
Author: ar
Time: 14 October 2009, 8:49:48 am
UUID: a603d2fe-dccf-894f-95db-ef577480b03c
Ancestors: Kernel-nice.270, Kernel-ul.270

Merging Kernel-ul.270:

- faster DateAndTime and Date creation with #year:month:day: and friends
- minor formatting fixes

=============== Diff against Kernel-nice.270 ===============

Item was changed:
  ----- Method: DateAndTime>>midnight (in category 'squeak protocol') -----
  midnight
  	"Answer a DateAndTime starting at midnight local time"
  
+ 	^self class basicNew
+ 		setJdn: jdn
+ 		seconds: 0
+ 		nano: 0
+ 		offset: self class localOffset
- 	^ self
- 		dayMonthYearDo: [ :d :m :y | self class year: y month: m day: d ]
  !

Item was changed:
  ----- 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
- 	"Return a DateAndTime" 	^ self
   		year: year
   		month: month
   		day: day
   		hour: hour
  		minute: minute
  		second: 0
  !

Item was changed:
  ----- 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"
  
+ 	| monthIndex daysInMonth p q r s julianDayNumber |
- 	| monthIndex daysInMonth p q r s julianDayNumber since |
  
  	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 ).
  
+ 	^self basicNew
+ 		setJdn: julianDayNumber 
+ 		seconds: hour * 60 + minute * 60 + second
+ 		nano: nanoCount
+ 		offset: offset;
- 	since := Duration days: julianDayNumber hours: hour 
- 				minutes: minute seconds: second nanoSeconds: nanoCount.
- 
- 	^ self basicNew
-  		ticks: since ticks offset: offset;
  		yourself!

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




More information about the Squeak-dev mailing list