TimeZoneDatabase V1.2.2
Integration of the time zone database with Squeak Kernel-Chronology.
Version 1.2.2 adds class TimeZoneProxy, which provides TimeZone protocol
for the local time zone transform in a TimeZoneDatabase. This permits
methods such as DateAndTime class>>now and Time class>>now to obtain
the correct time zone offset for any PointInTime, with compensation for
daylight savings time and other peculiarities.
Rather than relying on a static definition of the time zone, expressions
such as 'DateAndTime now' and 'Time now' will perform a dynamic lookup
into the time zone database to determine the time zone offset. When daylight
savings time takes effect, the time zone database will
automatically compensate for the change.
Also, time zone offsets can now be expressed as Durations, as in:
TimeZoneDatabase systemDatabase
durationFrom: 'America/Detroit' to: 'Canada/Newfoundland'
==> -0:01:30:00
Here is how to load a time zone database and set the default time zone on a
Squeak image running on a typical Linux box:
1) Build a system database from files in the /usr/share/zoneinfo directory
(a typical location for a Unix/Linux system).
TimeZoneDatabase buildSystemDatabaseForSqueak
2) Look for a suitable time zone to use. For example, if you live in Detroit,
Michigan in the USA, you can find several valid time zone entries for Detroit
by evaluating the following expression:
TimeZoneDatabase systemDatabase grepFor: 'Detroit'
3) Select a time zone to use as your default. For example, if you have decided
to use 'America/Detroit', tell the database that this should be the default:
TimeZoneDatabase systemDatabase defaultLocation: 'America/Detroit'
4) Now tell Squeak to use this as its dynamic time zone setting.
TimeZoneProxy
setDynamicLocalTransform: TimeZoneDatabase systemDatabase defaultTimeZone
abbreviation: 'EST'
- Dave