How to configure timezone for Linux server

Jephe Wu - http://linuxtechres.blogspot.com

Objective:  configure timezone for Linux server for all kinds of situations.
Environment: RHEL 5, CentOS 5, ssh users are from different time zone


Steps:
1.  Configure BIOS time and /etc/sysconfig/clock to set the timezone of the system (most important)
The /etc/sysconfig/clock file controls the interpretation of values read from the system hardware clock.
Configure BIOS time correctly first, if you used localtime in BIOS, then set UTC=false in /etc/sysconfig/clock.

ZONE="Asia/Singapore" 
UTC=false
ARC=false
You should set BIOS as GMT time and set UTC and ARC as true when it's under the following situations:
a. server observes daylight saving time
b. the users of the server will be from the different timezone

You  can use one of the following command to configure the timezone for the system:
setup (choose timezone configuration)

system-config-time
timeconfig

UTC stands for the Universal Time, Coordinated, also known as Greenwich Mean Time (GMT).
ARC line has no effect on Linux OS, leave it and ignore it.


2.  For server itself to display the correct timezone when issuing command 'date', you have to configure /etc/localtime to point to the correct compiled timezone file under /usr/share/zoneinfo/ directory

ln -sf /usr/share/zoneinfo/Asia/Singapore /etc/localtime
or
cp /usr/share/zoneinfo/Asia/Singapore /etc/localtime

3. For those users in different timezone with the server itself, you can configure TZ environment variable for the user's shell session:

To configure a different time zone from the system-wide default for an individual user, add the following line to the .bashrc in that user's home directory:

export TZ="/usr/share/zoneinfo/<timezone_directory>/<timezone_file>" 
 
You can add above line to the .bashrc file under user home directory.


4.  What's the RPM package for timezone and dump timezone information in /usr/share/zoneinfo/
# rpm -qf /usr/share/zoneinfo/Asia/Singapore
tzdata-20101-1.el5


[root@oracle ~]# zdump -v -c 2010,2012 Australia/Sydney  | more
Australia/Sydney  Fri Dec 13 20:45:52 1901 UTC = Sat Dec 14 06:45:52 1901 EST isdst=0 gmtoff=36000
Australia/Sydney  Sat Dec 14 20:45:52 1901 UTC = Sun Dec 15 06:45:52 1901 EST isdst=0 gmtoff=36000
Australia/Sydney  Sat Apr  3 15:59:59 2010 UTC = Sun Apr  4 02:59:59 2010 EST isdst=1 gmtoff=39600
Australia/Sydney  Sat Apr  3 16:00:00 2010 UTC = Sun Apr  4 02:00:00 2010 EST isdst=0 gmtoff=36000
Australia/Sydney  Sat Oct  2 15:59:59 2010 UTC = Sun Oct  3 01:59:59 2010 EST isdst=0 gmtoff=36000
Australia/Sydney  Sat Oct  2 16:00:00 2010 UTC = Sun Oct  3 03:00:00 2010 EST isdst=1 gmtoff=39600
Australia/Sydney  Sat Apr  2 15:59:59 2011 UTC = Sun Apr  3 02:59:59 2011 EST isdst=1 gmtoff=39600
Australia/Sydney  Sat Apr  2 16:00:00 2011 UTC = Sun Apr  3 02:00:00 2011 EST isdst=0 gmtoff=36000
Australia/Sydney  Sat Oct  1 15:59:59 2011 UTC = Sun Oct  2 01:59:59 2011 EST isdst=0 gmtoff=36000
Australia/Sydney  Sat Oct  1 16:00:00 2011 UTC = Sun Oct  2 03:00:00 2011 EST isdst=1 gmtoff=39600
Australia/Sydney  Mon Jan 18 03:14:07 2038 UTC = Mon Jan 18 14:14:07 2038 EST isdst=1 gmtoff=39600
Australia/Sydney  Tue Jan 19 03:14:07 2038 UTC = Tue Jan 19 14:14:07 2038 EST isdst=1 gmtoff=39600



5. useful commands and references:
clock --systohc
hwclock

http://www.g-loaded.eu/2009/10/07/how-to-change-the-timezone/