01-08-2013 12:31 PM
HPUX 11.31 (itanium), time syncing with local NTP server.
I want to change my current timezone to GST (gulf standard time) which is GMT+4
I have tried to set the timezone usnig
but the required GST time zone is not available there, even I have setted GMT+4 manually but it didn't help.. date command showing different time zone..
Do I need to modify /ur/lib/tztab file with any changes ?? or any perticular patch is required to get the GST time zone?
or is there is any other procedure to follow to change the time zone..
Any help appreciated...
Solved! Go to Solution.
01-08-2013 12:47 PM
I find nothing about a GST (Gulf Standard Time) timezone in the tztab file. I also checked the latest tztab patch (PHCO_42539 for 11.31) and there is no reference to GST there either.
I think the only thing you can do at this point is create your own time zone in the tztab file. Once you have your time zone created, then you can specify it with the TZ variable and/or /etc/TIMEZONE file.
Have a look at the tztab man page for more details.
01-08-2013 10:36 PM
>I want to change my current timezone to GST (gulf standard time) which is GMT+4
If there is no DST with this timezone, then you can simply use:
>create your own time zone in the tztab file.
Caution: Once you do this, you will no longer be able to patch tztab. The control script detects it has custom changes and will refuse to change it. (You can of course take apart the patch and manually add the changes.)
01-09-2013 12:27 AM
The TZ variable usually contains up to three things:
- the timezone name (usually three letters)
- the timezone offset
- an optional Daylight Saving Time timezone name (which may be longer than 3 letters)
The timezone offset for the TZ environment variable is defined a bit oddly, for historical reasons: it's the value you must add to the local time in order to get the UTC/GMT value, rather than vice versa. (When Unix was developed in the USA, the developers wanted to use simple positive integers for the North American timezones, and did not think too much about intercontinental use at that time. In order to stay compatible, the timezones of the Eastern Hemisphere had to use negative offset values. This rule is written into the POSIX standards, so it would be difficult to change it now.)
So, an Eastern Hemisphere timezone GST that is 4 hours east of Greenwich should be specified as "TZ=GST-4", not as GMT+4.
If your timezone does not use the Daylight Saving Time convention, you don't have to edit /usr/lib/tztab at all: the system will automatically use any timezone name you specify in the TZ variable. After all, the only information the system really needs is the offset value. The timezone name is just a convenient string for human use. Just edit /etc/TIMEZONE to set the timezone you need, then reboot to ensure that all the system daemons are using the new default timezone.
The /usr/lib/tztab is only used for timezones that follow the Daylight Saving Time convention: if the TZ variable includes the DST timezone name, the entire TZ value is used to look up the appropriate DST switching rules from /usr/lib/tztab, and the rules are applied to find the actual timezone offset for the date/time combination. If there is no DST, there is no need to look up anything, and the timezone offset in the TZ variable is used as-is.
01-09-2013 03:22 AM
For unlisted timezone use minus (-) instead of + (plus) even though your required timezone is GMT+4.
It is really intersting that how tz value work.See below comments from man page :
The TZ is set with a +7 offset and, as in the man pages for environ(5):
TZ TZ sets time zone information. TZ can be set using the
STD and DST Three or more bytes that designate the
standard time zone (STD) and summer (or
daylight-savings) time zone (DST). STD is
required. If DST is not specified, summer
time does not apply in this locale. Any
characters other than digits, comma (,), minus
(-), plus (+), or ASCII NUL are allowed.
offset offset is the value that must be added to
local time to arrive at Coordinated Universal
Time (UTC). Offset is of the form....
BR \\ Aungshu
01-09-2013 06:21 AM
Many thanks for the valuable inputs...
I have setted it to WST-4 and it is working as client needed.
Time is properly syncing with NTP server,,,but no GST format.. I need to look in to tztab file in detail to add GST
03-17-2014 04:40 AM
When you say,"After all, the only information the system really needs is the offset value. The timezone name is just a convenient string for human use.", does that mean that if I do not provide the offset value (say TZ=CET), it is simply considered the same as GMT(UTC)?
03-17-2014 07:41 PM
>I do not provide the offset value (say TZ=CET), it is simply considered the same as GMT(UTC)?
That's correct, a simple check will confirm it.
$ TZ=CET date; TZ=UTC0 date
But TZ under environ(5) indicates that the offset is required:
03-18-2014 03:17 AM
Thanks, that clear some confusion since on some other platforms(like Linux,SunOs,AIX) when offset value is not provided, it still gives the correct results as the STD specified and not UTC. But, I believe that is the way HP-UX implements it.
03-18-2014 12:43 PM - edited 03-18-2014 12:51 PM
>that is the way HP-UX implements it
tztab(4) only implements matches of the TZ string. So if the offset isn't encoded, that STD only entry would have to be in tztab. And since the major purpose of tztab is to match DST changes, they usually have all three fields.
>other platforms (like Linux,
A quick check with Linux, if you use MST, it understands it. But not MDT. So this "feature" is useless in the US for more than half the year. And for Linux, they are more apt to use the Java style: TZ=:region/city