[squeak-dev] The Trunk: Chronology-Core-dtl.68.mcz

commits at source.squeak.org commits at source.squeak.org
Sun Jul 4 20:17:59 UTC 2021


David T. Lewis uploaded a new version of Chronology-Core to project The Trunk:
http://source.squeak.org/trunk/Chronology-Core-dtl.68.mcz

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

Name: Chronology-Core-dtl.68
Author: dtl
Time: 4 July 2021, 4:17:58.647324 pm
UUID: 583e7bf7-ac3c-4ff3-9217-22e3045ec5b5
Ancestors: Chronology-Core-dtl.67, Chronology-Core-ct.52

Merge Chronology-Core-ct.52

The 'Z' format in Java's SimpleDateFormat is documented as support for RFC 822 time zone specifications (used in email), whereas our DateAndTime class>>readFrom: is used to parse ISO 8601 format date strings. So on the face of it, this enhancement seems out of place for the Squeak parser. However, if we can believe Wikipedia, it would also be considered as a valid ISO 8601 offset specifier. Merged.

References:
	https://docs.oracle.com/javase/8/docs/api/java/text/SimpleDateFormat.html
	https://en.wikipedia.org/wiki/ISO_8601#Time_offsets_from_UTC

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

Item was changed:
  ----- Method: DateAndTime class>>readFrom: (in category 'squeak protocol') -----
  readFrom: aStream
  
+ 	| yearMonthDay hourMinuteSecondNano offsetSeconds |
- 	| offsetSeconds ch yearMonthDay hourMinuteSecondNano offset |
  
  	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 |
- 			ifFalse: [
  				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'.
- 				offset := Duration fromString: ch asString, '0:', aStream upToEnd, ':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
   	"!



More information about the Squeak-dev mailing list