[squeak-dev] A UTC based implementation of DateAndTime

J. Vuletich (mail lists) juanlists at jvuletich.org
Mon May 26 14:17:47 UTC 2014


Hi David, Folks,

Quoting "David T. Lewis" <lewis at mail.msen.com>:

> I have been working on a variation of class DateAndTime that replaces its
> instance variables (seconds offset jdn nanos) with two instance variables,
> utcMicroseconds to represent microseconds elapsed since the Posix epoch, and
> localOffsetSeconds to represent the local time zone offset. When  
> instantiating
> the time now, A single call primitiveUtcWithOffset is used to obtain these
> two values atomically as reported by the underlying platform.
>
> There are several advantages to this representation of DateAndTime, the most
> important of which is that its magnitude is unambiguous regardless  
> of daylight
> savings transitions in local time zones.
>
> This is my attempt to address some historical baggage in Squeak. The VM
> reports time related to the local time zone, and the image attempts to
> convert to UTC (sometimes incorrectly). A UTC based representation makes the
> implementation of time zone tables more straightforward (see for example
> the Olson time zone tables in TimeZoneDatabase on SqueakMap).
> ...
> Dave

I very much support this approach. I did a bit of testing of  
<primitive: 'primitiveUtcWithOffset'> . I found that on a Mac, with  
'Croquet Closure Cog VM [CoInterpreter VMMaker.oscog-eem.331] Squeak  
Cog 4.0.2776' 'Mac OS' 'intel' '1092' (from Eliot's site), the second  
element I get (time zone offset) is -140473411.

The correct value would be -10800, as answered in Windows. I could not  
test on Linux yet (could not get the vm to run in Ubuntu 14.04 64 bit  
:( ).

Any clue on what's wrong on Mac OS?

BTW, which would be the current non-Cog VMs to try?

Thanks,
Juan Vuletich
Cheers,
Juan Vuletich



More information about the Squeak-dev mailing list