A UTC based implementation of DateAndTime

A UTC based implementation of DateAndTime project page

As of January 2019 this project has been merged in Squeak trunk in package Chonology-Core.


The traditional implementation of DateAndTime uses instance variables 'seconds offset jdn nanos' and calculates its magnitude based on those varables in conjunction with the local TimeZone.


Replace this with an implementation using instance variables 'utcMicroseconds localOffsetSeconds'. This represents time magnitude as elapsed microseconds since the Posix epoch, with localOffsetSeconds representing local offset from UTC. The magnitude is used for comparison and duration calculations, and the local offset is used for displaying this magnitude in the context of a local time zone.
The implementation ignores leap seconds, which are adjustments made to maintain earth rotational clock time in synchronization with elapsed seconds.


DateAndTime class>>now will use #primitiveUtcWithOffset to obtain current time in UTC microseconds with current local offset in seconds. The primitive provides an atomic query for UTC time and local offset as measured by the OS platform. If primitiveUtcWithOffset is not available, the traditional implementation is used, which relies on a primitive for microseconds in the local time zone and derives UTC based on the TimeZone setting.


Updates in package Chronology-Core are decendents of Squeak trunk Chronology-Core-cmm.2. These are suitable for Squeak trunk as of March 2016.


The changes should be loaded in sequence beginning with Chronology-Core-dtl.3. Begin by loading the first four files, then load the most recent version.


CAUTION: These changes are not easily reversed. Try them first in a throw away image.

Chronology-Core-dtl.39.mcz
Chronology-Core-cmm.38.mcz
Chronology-Core-dtl.37.mcz
Chronology-Core-dtl.36.mcz
Chronology-Core-dtl.35.mcz
Chronology-Core-dtl.34.mcz
Tests-UTCDateAndTime-dtl.2.mcz
Chronology-Core-cmm.33.mcz
Chronology-Core-dtl.32.mcz
Chronology-Core-dtl.31.mcz
Chronology-Core-dtl.30.mcz
Chronology-Core-dtl.29.mcz
Chronology-Core-dtl.28.mcz
Chronology-Core-dtl.27.mcz
DateAndTimePerformance-dtl.2.mcz
Chronology-Core-dtl.26.mcz
Chronology-Core-dtl.25.mcz
Chronology-Core-dtl.24.mcz
Chronology-Core-dtl.23.mcz
Chronology-Core-dtl.22.mcz
Chronology-Core-dtl.21.mcz
Chronology-Core-dtl.20.mcz
Chronology-Core-dtl.19.mcz
Chronology-Core-dtl.18.mcz
Chronology-Core-dtl.17.mcz
Chronology-Core-dtl.16.mcz
Chronology-Core-dtl.15.mcz
Chronology-Core-dtl.14.mcz
Chronology-Core-ul.13.mcz
Chronology-Core-dtl.12.mcz
Chronology-Core-dtl.11.mcz
Chronology-Core-dtl.10.mcz
DateAndTimePerformance-dtl.1.mcz
Chronology-Core-dtl.9.mcz
Chronology-Core-dtl.8.mcz
Chronology-Core-dtl.7.mcz
Chronology-Core-dtl.6.mcz
Chronology-Core-dtl.5.mcz
Chronology-Core-dtl.4.mcz
Chronology-Core-dtl.3.mcz
update-dtl.354.mcm
update.utc-dtl.1.mcm
update-dtl.353.mcm
update-dtl.355.mcm
update.utc-dtl.2.mcm
update.utc-dtl.4.mcm
update.utc-dtl.3.mcm
update.utc-dtl.5.mcm
update.utc-dtl.6.mcm
update-dtl.1.mcm
update-dtl.350.mcm
update-dtl.351.mcm
update-dtl.352.mcm
update-dtl.2.mcm