Ask Doctor Shell ...
This site uses stylesheets and XHTML1.1. You might want to switch to a modern browser like Firefox, Mozilla, or maybe IE6.

How do I have to setup timezones on my systems?

I have a time server running on Linux. The timezone is set to Pakistan's Standard Time "Asia Karachi". On the Solaris server, the timezone is set to GMT+5. When I'm running the ntp client on Solaris to synchronize time, Solaris time gets a difference of 5 hours. How do I have to setup timezones on my systems?

Solution:

The TZ variable basicallay consists of a timezone and an offset to CUT (or GMT). If the local time is ahead of GMT, as in your case, the offset is negative, if the local time is behind GMT, as e.g. with the US, the offset is positive.

Read the environ(5) manual page:

Offset indicates the value one must add to the local time to arrive at Coordinated Universal Time.

...

If preceded by a "-" the timezone is east of the Prime Meridian; otherwise it is west (which may be indicated by an optional preceding "+" sign).

So, you should indicate your local timezone with an offset of -5 and should name it something reasonable, like "PLT" (according to W3C - don't know if this is ok). Your TZ variable should look like "PLT-5" on both machines.

If you don't have the offset defined on your Linux box, the system assumes you are living in CUT/GMT time, but have a different name for any reason.

If you have defined GMT+5 on your Solaris machine, Solaris assumes your time is the local time of the US east cost, but you name it "GMT" for any strange reason.

The name of the timezone doesn't have a meaning. It's the offset that matters - and watch the sign!

If your Linux system is not setup properly, this is one of the rare cases, where a reboot makes sense after a reconfiguration.

Good luck!

In the end ... :-)

GMT-5 solved the problem. Thanks.

... there still is an issue:

But Dr. Shell still has an issue: While your timezone is 5 hours ahead of GMT, the name of your timezone is not GMT! The best reference I found to timezone names was on the webpage of the W3 consortium; it suggests "PLT" for Pakistan. Setting TZ=PLT-5 wouldn't change the actual time setting but would make the output of the date command (and others) more reasonable.

Valid XHTML 1.1! Valid CSS!

@(#) $Id: 0003.shtml,v 1.13 2005/06/24 04:49:45 kdo Exp $