Free Hosting Online for WorkStations

< Previous | Contents | Next >

6.9.2.2. Adding time zone data

Install and set up the time zone data with the following:


tar -xf ../../tzdata2019b.tar.gz


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


for tz in etcetera southamerica northamerica europe africa antarctica \ asia australasia backward pacificnew systemv; do

tar -xf ../../tzdata2019b.tar.gz


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


for tz in etcetera southamerica northamerica europe africa antarctica \ asia australasia backward pacificnew systemv; do


zic zic zic

done

-L

-L

-L

/dev/null -d $ZONEINFO ${tz}

/dev/null -d $ZONEINFO/posix ${tz} leapseconds -d $ZONEINFO/right ${tz}

zic zic zic

done


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

unset ZONEINFO

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 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.9MB 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 savings time rules to be in accordance with US rules.

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


tzselect

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

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


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


Top OS Cloud Computing at OnWorks: