Re: Change Timezone 11.31 (1366 Views)
Reply
Frequent Advisor
Binubaby
Posts: 47
Registered: ‎04-13-2004
Message 1 of 12 (1,414 Views)
Accepted Solution

Change Timezone 11.31

Hello..

 

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

#set_parms timezone

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...

BB
Honored Contributor
Patrick Wallek
Posts: 13,776
Registered: ‎06-21-2000
Message 2 of 12 (1,412 Views)

Re: Change Timezone 11.31

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.

Acclaimed Contributor
Dennis Handly
Posts: 25,183
Registered: ‎03-06-2006
Message 3 of 12 (1,399 Views)

Re: Change Timezone 11.31

>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:

export TZ=GST-4

 

>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.)

Honored Contributor
Matti_Kurkela
Posts: 6,271
Registered: ‎12-02-2001
Message 4 of 12 (1,394 Views)

Re: Change Timezone 11.31

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.

MK
Occasional Advisor
aungshu
Posts: 11
Registered: ‎05-28-2011
Message 5 of 12 (1,386 Views)

Re: Change Timezone 11.31

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
                  format:

 

                     [:]STDoffset[DST[offset][,rule]]

 

                  where:

 

                  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

Frequent Advisor
Binubaby
Posts: 47
Registered: ‎04-13-2004
Message 6 of 12 (1,381 Views)

Re: Change Timezone 11.31

Hello Again,

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

 

Regards

BB

BB
Frequent Advisor
Binubaby
Posts: 47
Registered: ‎04-13-2004
Message 7 of 12 (1,379 Views)

Re: Change Timezone 11.31

Hello

Typo  setted as GST-4 ( I have mentioned as WST-4)

 

Thanks to all for the contribution,, assigning points

 

BR

BB
Acclaimed Contributor
Dennis Handly
Posts: 25,183
Registered: ‎03-06-2006
Message 8 of 12 (1,366 Views)

Re: Change Timezone 11.31

>I need to look in to tztab file in detail to add GST

 

Again, no need to add it if you don't have DST.  And if you do, you'll have a bunch of problems getting to work.

Occasional Advisor
Phalgun
Posts: 8
Registered: ‎03-17-2014
Message 9 of 12 (871 Views)

Re: Change Timezone 11.31

Hi MK,

 

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)? 

Acclaimed Contributor
Dennis Handly
Posts: 25,183
Registered: ‎03-06-2006
Message 10 of 12 (865 Views)

Re: Change Timezone 11.31

>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:

[:]STDoffset[DST[offset][,rule]]

Occasional Advisor
Phalgun
Posts: 8
Registered: ‎03-17-2014
Message 11 of 12 (859 Views)

Re: Change Timezone 11.31

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.

Acclaimed Contributor
Dennis Handly
Posts: 25,183
Registered: ‎03-06-2006
Message 12 of 12 (850 Views)

Re: Change Timezone 11.31

[ Edited ]

>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

The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation.