OverviewA time zone is a system that is used for relating local times in different geographical areas to one another. For example, in the United States, Pacific Time is three hours earlier than Eastern Time; when it's 6 P.M. in San Francisco, it's 9 P.M. in Brooklyn. To make things simple, instead of relating time zones to one another, all time zones are related to a common reference point. For historical reasons, the reference point is Greenwich, England. Local time in Greenwich is referred to as Greenwich Mean Time, or GMT. (This is similar, but not precisely identical, to Universal Coordinated Time, or UTC. We use the two terms interchangeably in ICU since ICU does not concern itself with either leap seconds or historical behavior.) Using this system, Pacific Time is expressed as GMT-8:00, or GMT-7:00 in the summer. The offset -8:00 indicates that Pacific Time is obtained from GMT by adding -8:00, that is, by subtracting 8 hours. The offset differs in the summer because of daylight savings time, or DST. At this point it is useful to define three different flavors of local time:
Time Zones in ICUICU supports time zones through two classes:
Timezone classes are related to UDate, the Calendar classes, and the DateFormat classes. Timezone Class in ICUTimeZone is an abstract base class. It defines common protocol for a hierarchy of classes. This protocol includes:
Factory Methods and the Default TimezoneThe TimeZone factory method createTimeZone() creates and returns a TimeZone object given a programmatic ID. The user does not know what the class of the returned object is, other than that it is a subclass of TimeZone. The createAvailableIDs() methods return lists of the programmatic IDs of all zones known to the system. These IDs may then be passed to createTimeZone() to create the actual time zone objects. ICU maintains a comprehensive list of current international time zones, as derived from the Olson data. TimeZone maintains a static time zone object known as the default time zone. This is the time zone that is used implicitly when the user does not specify one. ICU attempts to match this to the host OS time zone. The user may obtain a clone of the default time zone by calling createDefault() and may change the default time zone by calling setDefault() or adoptDefault(). Display NameWhen displaying the name of a time zone to the user, use the display name, not the programmatic ID. The display name is returned by the getDisplayName() method. A time zone may have three display names:
Furthermore, each of these names may be LONG or SHORT. The SHORT form is typically an abbreviation, e.g., "PST", "PDT". In addition to being available directly from the TimeZone API, the display name is used by the date format classes to format and parse time zones. getOffset() APITimeZone defines the API getOffset() by which the caller can determine the difference between local time and GMT. This is a pure virtual API, so it is implemented in the concrete subclasses of TimeZone. Updating the Time Zone DataTime zone data changes often in response to governments around the world changing their local rules and the areas where they apply. The ICU time zone data is updated for each release, and the easiest way to stay up to date may be to upgrade to the latest ICU release, which also provides bug fixes, code improvements and additional features. If an ICU upgrade is not practical, then an old ICU installation needs to be updated. As with other systems (and very similar to with currency changes), it is only possible to update a system either after the new rules are already in effect, or if the system supports historical time zones, that is, for a given time zone ID it supports different rules for different years. For example, if a system is updated in 2006 with time zone data that includes the 2007 changes to US daylight savings time rules, then it needs to apply the old rules in 2006 and earlier years and the new rules in 2007 and later. Please use the following table to figure out whether time zone data can be updated for the version of ICU that you are using.
The time zone data in ICU is generated from the industry-standard TZ database using the tzcode (http://source.icu-project.org/repos/icu/icu/trunk/source/tools/tzcode/ ) tool. The ICU data files with recent time zone data can be downloaded from the update URL, http://source.icu-project.org/repos/icu/data/trunk/tzdata/icunew/ . Update the time zone data for ICU4CIf the ICU-using application sets an ICU data path (or can be changed to set one), then the time zone .res file can be placed there. (It needs to have the proper platform endianness.) Otherwise, if the ICU data is installed as a .dat package file, the .res file can be integrated using the new icupkg tool. Otherwise - if the data is packaged into a DLL and the data path is not set - the .txt source data file can be used to rebuild the data DLL.
1. Download ICU4C binaries for latest release of from http://www.icu-project.org/download/ . 2. Unzip the binaries and set up environment variables. Unix
Windows
3. Download the appropriate time zone data resource file(s) from http://source.icu-project.org/repos/icu/data/trunk/tzdata/icunew/
. Each directory contains the ICU time zone data for the tzdata
version, e.g.: data for tzdata version 2010e is in directory named
“2010e”. Now traverse to the directory under version directory that is
appropriate to ICU version and your system, e.g.: download http://source.icu-project.org/repos/icu/data/trunk/tzdata/icunew/2010e/38/le/zoneinfo.res
for little endian systems, http://source.icu-project.org/repos/icu/data/trunk/tzdata/icunew/2010e/38/be/zoneinfo.res
for big endian systems and http://source.icu-project.org/repos/icu/data/trunk/tzdata/icunew/2010e/38/ee/zoneinfo.res
for EBCIDIC systems. The chart below shows ICU versions and its corresponding sub directories and time zone resource files under each tzdata version directory.
4. Replace the resource zoneinfo.res in icudt38l.dat with the downloaded version. (zoneinfo64.res for ICU 4.4 or later release)
5. Repeat the same operation for other resources for the release. For example, ICU4C 3.8.1 also needs metazoneInfo.res and supplementalData.res.
Update the time zone data for ICU4J 3.4.2 and laterThere is a utility called ICU4J Time Zone Update Update Utility. Please follow the link and download the tool for updating the time zone data for ICU4J 3.4.2 and later. See the Date and Time Zone Examples subpage.
|