The Time Zone Database (often called tz or zoneinfo) contains code and data that represent the history of local time for many representative locations around the globe. It is updated periodically to reflect changes made by political bodies to time zone boundaries, UTC offsets, and daylight-saving rules.
Both of these packages are to be built and configured together as they do not extract to a dedicated path name, so you need to create a directory first before extracting.
Prepare Timezone Diectory:
mkdir -v timezone &&
cd timezone
tar -xf ../tzcode2025b.tar.gz
tar -xf ../tzdata2025b.tar.gz
Compile the package:
make CC=gcc zic zdump tzselect
This package does not come with a testsuite:
Install the package:
install -m755 zic /usr/bin && install -m755 zdump /usr/bin && install -m755 tzselect /usr/bin
Install and set up the time zone data with the following:
ZONEINFO=/usr/share/zoneinfo
mkdir -pv $ZONEINFO/{posix,right}
for tz in etcetera southamerica northamerica europe africa antarctica \
asia australasia backward; do
zic -L /dev/null -d $ZONEINFO ${tz}
zic -L /dev/null -d $ZONEINFO/posix ${tz}
zic -L leapseconds -d $ZONEINFO/right ${tz}
done
cp -v zone.tab zone1970.tab iso3166.tab $ZONEINFO
zic -d $ZONEINFO -p America/New_York
unset ZONEINFO tz
The meaning of the zic commands:
zic -L
/dev/null ...
This creates posix time zones without any leap seconds. It
is conventional to put these in both zoneinfo and zoneinfo/posix. It is necessary to put
the POSIX time zones 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 time zones,
you could save 1.9 MB by not using the posix directory, but some applications or
test suites might produce some failures.
zic -L
leapseconds ...
This creates right time zones, including leap seconds. On
an embedded system, where space is tight and you do not
intend to ever update the time zones, 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
saving time rules to be in accordance with US rules.
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 time zones 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/Pacific).