I'm not an expert in this, but nobody has been answering this question, so I'll give it a shot.
pk_kala, there are two ways to specify the applicable time zone: the default way and an optional way.
If you have not used the optional way (which I'll describe in a moment), the default way is via file
/etc/localtime. It's typically a symbolic link to some specific time zone file. Here's what happens on my machine:
Code:
wally:~$ ls -l /etc/localtime
lrwxrwxrwx 1 root root 30 Mar 11 10:39 /etc/localtime -> /usr/share/zoneinfo/US/Pacific
wally:~$
Try it on your machine to see what your default time zone is. That time zone applies for all requests for the local time of day, unless a specific process is using a different time zone. (I'm guessing here that your
syslogd is not using a different time zone.) So when you try the above command on your machine, you're likely to get the time zone used by
syslogd.
I'm about to describe the optional way to set the time zone, as I promised above.
A specific process (and all its children) can request the use of a different timezone from that specified by
/etc/localtime by setting the
TZ environment variable. (
TZ stands for "time zone".) This can be done automatically for you, for example, by your shell setup files. You can tell whether you have set
TZ by doing this at the shell prompt:
If you get no output, then
TZ is not set. If you get output, you get the name of the time zone which applies while you're running your shell. This is normally set by the usual shell initialization files (which I'll discuss later), but you can change it manually while you're running your shell.
I normally don't specify
TZ. Here's what happens when I play with that:
Code:
wally:~$ ls -l /etc/localtime
lrwxrwxrwx 1 root root 30 Mar 11 10:39 /etc/localtime -> /usr/share/zoneinfo/US/Pacific
wally:~$ # On the above line is the time zone which applies if TZ is not set.
wally:~$ env | grep '^TZ='
wally:~$ # Since the above line gave no output, I know that TZ is not set.
wally:~$ date
Wed Jul 18 05:40:23 PDT 2007
wally:~$ # Notice that the timezone used is, indeed, the Pacific timezone.
wally:~$ export TZ="US/Central"
wally:~$ env | grep '^TZ='
TZ=US/Central
wally:~$ date
Wed Jul 18 07:41:06 CDT 2007
wally:~$ unset TZ
wally:~$ env | grep '^TZ='
wally:~$ date
Wed Jul 18 05:41:28 PDT 2007
wally:~$
Do the same thing yourself and see what happens.
Finally, as I've promised, I'll discuss how
TZ could be set automatically for you, without you knowing it.
If the shell you're running is
bash (which is true for most Linux users), check the content of the following files. Not all of them exist, but check the ones that do exist:
- /etc/profile
- in your home directory, .bash_profile
- in your home directory, .profile
- in your home directory, .bashrc
The period ("
.") in three of the filenames is important; do not omit it.
If you're running some shell other than
bash, check the documentation for that shell.
Hope this helps.