[squeak-dev] Re: [Pharo-project] Epoch returns local offset

David T. Lewis lewis at mail.msen.com
Fri May 18 23:47:44 UTC 2012


On Fri, May 18, 2012 at 09:30:32PM +0200, Bert Freudenberg wrote:
> On 18.05.2012, at 19:22, Eliot Miranda wrote:
> 
> > 'From Smalltalk-80, version 2, of April 1, 1983 on 31 May 1983 at 9:10:35 am'!
> 
> That's obviously an April Fool's joke ;)
> 
> 
> But very interesting indeed. I had assumed that the way Squeak handles
> time is identical to how Smalltalk-80 did it. Apparently not, they must
> have simplified in the Mac version.
> 
> - Bert -
> 

The original Squeak implementation of Time class>>totalSeconds uses
primSecondsClock, which is documented as:

primSecondsClock
	"Answer the number of seconds since 00:00 on the morning of
	 January 1, 1901 (a 32-bit unsigned number).
	 Essential. See Object documentation whatIsAPrimitive. "

This does not specify whether it refers to the local time zone or to GMT,
and the actual implementation in Squeak has always used local time.

The Blue Book documents Time class>totalSeconds as "Answer the total seconds
from Jan. 1, 1901, corrected for time zone and daylight savings time."

And Time class>>timeWords is "Answer the seconds (in Greenwich Mean Time)
since Jan. 1, 1901 ..."

So it certainly does sound like totalSeconds was intended to be seconds
since Jan. 1, 1901 GMT, and it also appears that totalSeconds has been
implemented differently in Squeak.

After seeing Eliot's code reference, I'm inclined to think that the Blue
Book provided an unambiguous definition (though poorly worded), and that
Squeak has apparently been implementing it differently all along. There
is nothing in the Squeak image itself that gives a clue as to the original
intent (Time class>>timeWords is not present in Squeak), so the conflicting
implementations are now in wide circulation.

None of this does much to convince me that refering to a clearly defined
Posix epoch would be a bad idea ...

Dave
 


More information about the Squeak-dev mailing list