TZ environment

Latest response

Hi,

have some troubles regarding the timezone settings on a bunch of servers, running RHEL5.9.

The servers are located in Austria / CET, so I did the following timezone-configuration:

TZ=GMT+1
export TZ

Sadly, this setting does something wrong. The servers are now 1 hour behind GMT / 2 hours behind the local time (azores timezone).

 

I did a further test: 

 

TZ=GMT-1
export TZ

Now the servers are running on the correct local time, but I don't know why. In my mind, the local timezone is GMT+1, not GMT-1
I can't really find an answer, maybe someone here in this group is knowing an answer.
 
Thanks in advance
Falk

Responses

For server-wide settings, you need to link /etc/localtime to the appropriate /usr/share/zoneinfo file. Use the time-configuration utility to make life easy on yourself. Setting TZ in a shell initilization script only effects the shell (and subhells) that sourced that initialization script.

Quoting "info libc 'Date and Time' 'Calendar Time' 'TZ Variable'":

   The OFFSET specifies the time value you must add to the local time
to get a Coordinated Universal Time value.  It has syntax like
[`+'|`-']HH[`:'MM[`:'SS]].  This is positive if the local time zone is
west of the Prime Meridian and negative if it is east.  The hour must
be between `0' and `23', and the minute and seconds between `0' and
`59'.

Yes, this may be counterintuitive, but unfortunately this is what was codified in the relevant standard (POSIX.1).

I would recommend just setting TZ=Europe/Vienna instead.. no need to worry about the sign and having to update for daylight saving time.

Hi,

thank you all for the really fast replies and many thanks for the detailed explaination.

The TZ-variable is used by the software which is running on this server. I'll check if "TZ=Europe/Vienna" is usable by this tool, but I think so.

- Falk

Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.