[ANN][SM] TimeZoneDatabase V1.2.3 - dynamic time zone updates for DateAndTime

David T. Lewis lewis at mail.msen.com
Wed Nov 24 15:52:39 UTC 2004


TimeZoneDatabase V1.2.3 - A time zone database that dynamically updates
DateAndTime for any point in time in any locale, including daylight
savings time transitions.

Available on SqueakMap (or http://minnow.cc.gatech.edu/squeak/1076).

Here is an overview:

TimeZoneDatabase is a time zone database for Smalltalk. It answers the
number of seconds offset from UTC for any time zone at any point in time
in the range of the database rule set, as well as the number of leap
seconds for a point in time (for tzfiles which contain the leap second
rules). See the TimeZoneDatabase class comment for an explanation.

TimeZoneProxy provides a dynamic time zone to calculate DateAndTime at
any point in time in any time zone. Dynamic corrections for daylight
savings time and leap seconds are made according to the local time zone
setting. Time zone rules are provided by TimeZoneDatabase.

A TimeZoneDstTransitionWatcher detects "fall back" daylight savings time
transitions, and maintains correct conversions from the Squeak seconds clock
to absolute time. See the TimeZoneProxy and TimeZoneDstTransitionWatcher
class comments for information.

Class PointInTime is a representation of absolute atomic clock time.
This differs from the Posix representation of time, which corresponds
to Earth rotation and is adjusted occasionally by means of leap seconds;
and it differs from the Squeak seconds clock, which is a representation
of the local wall clock time display that ignores time zones, daylight
savings time, and leap seconds. The TimeZoneDatabase is used to provide
conversions between these representions of time that obey the rules in
the database for various time zones and for all point in time.  For an
explanation of the Squeak seconds clock and how it relates to various
representations of time, see the "documentation" method category in
class PointInTime.

A full time zone database requires access to tzfile data files, typically
distributed with Unix (Linux) systems. A limited set of tzfile files is
provided to initialize the database and demonstrate its functions. If a
full set of tzfile files is found on your system, it will be automatically
loaded into the database.

When TimeZoneDatabase is initially installed, the system time zone
(DateAndTime class>>localTimeZone) is set to 'UTC' (no UTC offset, no
daylight savings offset, no leap seconds). Here is how to set a new
default time zone for Squeak:

1) 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 grepFor: 'Detroit'

2) Optional: If you do not find a suitable time zone in your time zine
   database, you may want to build a new system database from files in
   the /usr/share/zoneinfo directory (a typical location for a Unix/Linux
   system). If your system does not have these files available, they may
   be copied from another system or obtained on the internet. A few
   representative time zone files are included in the TimeZoneDatabase
   distribution.
     TimeZoneDatabase buildSystemDatabaseForSqueak

3) Set a time zone to use as the system default. For example, if you
   have decided to use 'right/America/Detroit', tell Squeak to use this
   as its dynamic time zone setting:
     TimeZoneProxy setDynamicTransform: 'right/America/Detroit'
   or:
     TimeZoneProxy
       setDynamicTransform: 'right/America/Detroit'
       abbreviation: 'EST'

If you want to stop using TimeZoneDatabase for your Squeak time zone
settings and go back to a default TimeZone:
     DateAndTime localTimeZone: TimeZone default

Time zones with names that begin with "right" include the rules for leap
second adjustments, while time zones with names beginning with "posix"
will ignore leap seconds. You may need to experiment with your system to
find which time zone settings best matches your requirements.

- Dave




More information about the Squeak-dev mailing list