Operating System - HP-UX
1748008 Members
4732 Online
108757 Solutions
New Discussion

Re: Change Timezone 11.31

 
SOLVED
Go to solution
Binubaby
Frequent Advisor

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
11 REPLIES 11
Patrick Wallek
Honored Contributor

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.

Dennis Handly
Acclaimed Contributor
Solution

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

Matti_Kurkela
Honored Contributor

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
aungshu
Advisor

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

Binubaby
Frequent Advisor

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
Binubaby
Frequent Advisor

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
Dennis Handly
Acclaimed Contributor

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.

Phalgun
Occasional Advisor

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

Dennis Handly
Acclaimed Contributor

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