On Tue, Jul 10, 2012 at 6:08 PM, Camillo Bruni <camillobruni@gmail.com> wrote:
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?
The problem is that the epoch was always in local time so the logic behind it and tests were a mess. Now the epoch starts in one defined moment. Sorry for the failing tests but chronology tests were ok and the monkey reported no other failures so I supposed that the fix was working well. -- Pavel
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