6.12. Tzdata-2015d

The Tzdata package contains time zone and daylight-saving time data.

Approximate build time: less than 0.1 SBU
Required disk space: unknown

6.12.1. Installation of Tzdata

[Note]

Note

The tzdata tar file does not extract to a single directory as the other tar files do. To unpack, use:

mkdir -pv /sources/tzdata-2015d
cd /sources/tzdata-2015d
tar -x -f ../tzdata2015d.tar.gz

Install and set up the timezone data to a temporary directory with the following:

ZONEINFO=debian/tmp/usr/share/zoneinfo
mkdir -pv $ZONEINFO/{posix,right}

for tz in etcetera southamerica northamerica europe africa antarctica  \
          asia australasia backward pacificnew systemv; do
    zic -L /dev/null   -d $ZONEINFO       -y "sh yearistype.sh" ${tz}
    zic -L /dev/null   -d $ZONEINFO/posix -y "sh yearistype.sh" ${tz}
    zic -L leapseconds -d $ZONEINFO/right -y "sh yearistype.sh" ${tz}
done

cp -v zone.tab zone1970.tab iso3166.tab $ZONEINFO
zic -d $ZONEINFO -p America/New_York
unset ZONEINFO

The meaning of the zic commands:

zic -L /dev/null ...

This creates posix timezones, without any leap seconds. It is conventional to put these in both zoneinfo and zoneinfo/posix. It is necessary to put the POSIX timezones in zoneinfo, otherwise various test-suites will report errors. On an embedded system, where space is tight and you do not intend to ever update the timezones, you could save 1.9MB by not using the posix directory, but some applications or test-suites might produce some failures.

zic -L leapseconds ...

This creates right timezones, including leap seconds. On an embedded system, where space is tight and you do not intend to ever update the timezones, or care about the correct time, you could save 1.9MB by omitting the right directory.

zic ... -p ...

This creates the posixrules file. We use New York because POSIX requires the daylight savings time rules to be in accordance with US rules.

Create the package archive:

buildpkg

Install the package:

dpkg -i ../tzdata_2015d_*.deb

6.12.2. Configuration of Tzdata

One way to determine the local time zone is to run the following script:

tzselect

After answering a few questions about the location, the script will output the name of the time zone (e.g., America/Edmonton). There are also some other possible timezones listed in /usr/share/zoneinfo such as Canada/Eastern or EST5EDT that are not identified by the script but can be used.

Then create the /etc/localtime file by running:

ln -sfv /usr/share/zoneinfo/<xxx> /etc/localtime

Replace <xxx> with the name of the time zone selected (e.g., Canada/Eastern).

6.12.3. Contents of Tzdata

Installed directory: /usr/share/zoneinfo

Short Description

/usr/share/zoneinfo

Provides timezone and daylight saving time information for glibc time functions