Sunday, October 19, 2008

How To Set the Time Zone

Change directory to /usr/lib/zoneinfo/. Get the time zone package if you don't have this directory. The source is available inftp://metalab.unc.edu/pub/Linux/system/admin/time/.

Then make a symbolic link named localtime pointing to one of the files in this directory (or a subdirectory), and one called posixrules pointing tolocaltime. For example:

 $ ln -sf US/Mountain localtime  $ ln -sf localtime posixrules 

This change will take effect immediatelytry date.

If the system uses Red Hat-style configuration files, the respective time zone info files are /usr/share/zoneinfo and /etc/localtime.

The manual pages for tzset or tzselect describe setting the time zone. Some programs recognize the TZ environment variable, but this is not POSIX-correct.

You should also make sure that your Linux kernel clock is set to the correct GMT time. Type date -u and check that the correct UTC time is displayed. SeeWhy Does the Computer Have the Wrong Time?.

No comments: