[Pharo-project] timezone madness

Camillo Bruni camillobruni at gmail.com
Tue Jul 10 12:08:28 EDT 2012


I solve it the following way:

DateAndTime >> #fromSeconds: seconds 
	"Answer a DateAndTime since the Squeak epoch: 1 January 1901"

	| integerSeconds nanos |
	integerSeconds := seconds truncated.
	integerSeconds = seconds
		ifTrue: [nanos := 0]
		ifFalse: [nanos := (seconds - integerSeconds * NanosInSecond) asInteger].
	^ self basicNew
		ticks: (Array
				with: SqueakEpoch
				with: integerSeconds
				with: nanos)
		offset: self localOffset

DateAndTime >> #asSeconds
 	"Return the number of seconds since the Squeak epoch"
 
 	^ (self - (self class epoch) + self offset) asSeconds
 

asSeconds always returns an relative value to the universally know 
squeak epoch.

DateAndTime is a TimePoint + a TimeZone

done, no?

On 2012-07-10, at 17:56, Camillo Bruni wrote:

> I saw that some changes were included but 
> - they somehow break other tests
> - the standard offset in DateAndTime is set to 0 (instead of a Duration of length 0)
> 
> 
> can somebody quickly summarize the changes for me please? :)
> 
> best
> cami





More information about the Pharo-dev mailing list