Sean,

I have very little time because I need to prepare stuff for the PharoConf, so I 
haven't read all the mails and code that you produced on this subject.

But are you sure that this is incorrect ? I am mean, combining the clock 
seconds with the local offset should yield a proper time, no ? The TZ of the 
clock is then cancelled out as far as I see it.


This is code taken from https://github.com/svenvc/ztimestamp


ZTimestamp class side


now
        "Create and return a new ZTimestamp equal to the current system time"
        
        ^ self fromClockSeconds: (self clockSeconds - self clockTimezoneOffset)


fromClockSeconds: seconds
        "Create and return a new instance from a specific number of seconds 
since our clock epoch, see #now"
        
        ^ self new
                jdn: self clockEpoch julianDayNumber + (seconds // 86400)
                secs: self clockEpoch secondsSinceMidnight + (seconds \\ 86400)


clockEpoch
        "Return the epoch of the clock that we use as an instance (cached), see 
#now"
        
        ^ ClockEpoch ifNil: [
                ClockEpoch := self year: 1901 month: 1 day: 1 ]


clockSeconds
        "Return the total seconds count of the clock that we use as an Integer, 
see #now"

        ^ Time totalSeconds


clockTimezoneOffset
        "Return the timezone offset of the clock that we use as an Integer 
seconds (cached), see #now"

        ^ ClockTimezoneOffset ifNil: [
                ClockTimezoneOffset := DateAndTime localTimeZone offset 
asSeconds ]


I would love to learn/discuss more, later on.
It feels like you are changing dangerous things, someone else should check this 
out.
But cleanups are of course welcome.


Sven


On 17 May 2012, at 21:11, Sean P. DeNigris wrote:

> Fix in inbox: Name: SLICE-Issue-5913-Remove-Squeak-epoch-SeanDeNigris.1
> 
> This was a complicated change that's obviously at the core of the system.
> Although all 385 of KernelTests-Chronology tests pass[1], I'd really
> appreciate some feedback and testing...
> 
> [1] except the DateAndTime*EpochTest classes, which should be removed; see
> below
> 
> General
> * Update all comments referencing the Squeak Epoch
> * There is a VM primitive that returns current seconds since the Squeak
> epoch. For now, I have adjusted all users of this primitive for the Unix
> epoch, but it would be cleaner to change the primitive and remove this hack
> 
> Kernel-Chronology
> * Change SqueakEpoch from ChronologyConstants
>       - rename to UnixEpoch
>       - change value to that of UnixEpoch
> * Replace all uses of SqueakEpoch with UnixEpoch
> * change DateAndTime class>>epoch to use UTC
> 
> KernelTests-Chronology
> * Fix all tests to pass, except the DateAndTime*EpochTest classes, which are
> incredibly redundant and should be removed (Issue 5910: [Cleanup]: Gut
> DateAndTimeDosEpochTests)
> * Removed many magic numbers
> * cleaned and refactored
> 
> Other
> * Fix MailMessage and MessageList to use new epoch

--
Sven Van Caekenberghe
http://stfx.eu
Smalltalk is the Red Pill


Reply via email to