[squeak-dev] The Trunk: Chronology-Core-cmm.3.mcz

commits at source.squeak.org commits at source.squeak.org
Fri Mar 18 18:31:27 UTC 2016


Chris Muller uploaded a new version of Chronology-Core to project The Trunk:
http://source.squeak.org/trunk/Chronology-Core-cmm.3.mcz

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

Name: Chronology-Core-cmm.3
Author: cmm
Time: 18 March 2016, 1:31:09.337847 pm
UUID: 4e36f7ad-aa95-433a-bb7f-198798b81942
Ancestors: Chronology-Core-cmm.2

- When the localTimeZone is explicitly updated by the user, ensure the system does not silently change it back if the user didn't remember to also turn off automaticTimeZone:.
- Added DateAndTime class>>#nowAtOffset: to obtain the local time at other places than the localTimeZone.

=============== Diff against Chronology-Core-cmm.2 ===============

Item was changed:
  ----- 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: false!
- 
- 	LocalTimeZone := aTimeZone
- 
- 
- !

Item was changed:
  ----- Method: DateAndTime class>>now (in category 'ansi protocol') -----
  now
  	| clockAndOffset |
  	clockAndOffset := self clock localMicrosecondClockWithOffset.
  	(self automaticTimezone and:
  		[self localOffset asSeconds ~= clockAndOffset second])
+ 			ifTrue: [self setLocalTimeZoneAutomatically: (Duration seconds: clockAndOffset second)].
- 			ifTrue: [self localOffset: (Duration seconds: clockAndOffset second)].
  	^self now: clockAndOffset first offset: self localOffset!

Item was added:
+ ----- 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 now + (offsetDuration - self localOffset) offset: offsetDuration!

Item was added:
+ ----- Method: DateAndTime class>>setLocalTimeZoneAutomatically: (in category 'squeak protocol') -----
+ setLocalTimeZoneAutomatically: aDuration
+ 	"Set the duration we are offset from UTC (done automatically in #now)"
+ 	LocalTimeZone := (TimeZone offset: aDuration name: 'Local Time' abbreviation: 'LT').
+ !



More information about the Squeak-dev mailing list