Operating System - HP-UX
1819722 Members
3348 Online
109606 Solutions
New Discussion юеВ

Re: Change to GMT time zone

 
Mike Roger
Advisor

Change to GMT time zone


Hi

1- I'm in WAT-3 zone and I want to change it to GMT format "GMT+3". When I change it and fix the time to our local time. I check the date it gives me the right local time, but when I check the date -u it gives me the UTC time but with +6 hours than what it should be??

2- How can I make sure that the time that I put it will not change automatically to the day/light timing? "I want it to be a fix time year around without change.

Thanks,
Mike
7 REPLIES 7
Steven E. Protter
Exalted Contributor

Re: Change to GMT time zone

env | grep TZ

That might be set wrong, still

date -u is supposed to give GMT btw, but I think you know that.

I don't think the OS is going to do the time change automatically unless you are using ntp, but things may have changed in the 6 or so years I've had us on NTP.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Bill Hassell
Honored Contributor

Re: Change to GMT time zone

HP-UX always keeps time in GMT (Zulu) time. When your machine was installed, it asked what timezone it was in. When the current date and time were set, it was translated into GMT for HP-UX to use. HP-UX never changes time including daylight saving. Instead, a file called /etc/TIMEZONE is sourced during login and the vcariable $TZ is set to represent the internal GMT value to whatever you would like. That's why HP-UX can be accessed worldwide and show local time by setting TX appropriately. Read the man page for tztab. This file is located in /usr/lib/tztab.

Since you need to change the current time, it is *always* best to shutdown all applications (or perhaps go to single user mode), then run the command:

/sbin/set_parms date_time

Set the timezone you'd like to use and then set the time of day and date. You will also need to change the kernel parameter timezone and dst. Run SAM and read the Help on Context for these 2 paramters.


Bill Hassell, sysadmin
Mike Roger
Advisor

Re: Change to GMT time zone

THANKKS Steve for your input, I already got you 6 point and you will get more for the right answer ....

Let me put this way, Weare in the cuntry of Qatar "GMT + 3". When I first set the server or do /sbin/set_parms timezone it doesn't show me Qatar as a zone under Asia. so I take the closest with the same timing Saudi Arabia. It shows me that the my time zone is WAT-3 !!!!

Some of our application don't recognize WAT, so we would like to change it to GMT format which is GMT+3. after I set the GMT+3 as my TZ and set the correct time. # date shows me the right time "example 16:00". When I do # date -u we expect 13:00 since we are 3hours ahead of GMT, but it shows us 19:00 !!!!!!

What shall I do inorder to get my local time with GMT+3 TZ when I do #date and to get GMT "UTC" when I do #date -u ?????

could some one confirm that the system time will night change AUTOMATICALLY to daylight since I'm using NTP?
Bill Hassell
Honored Contributor

Re: Change to GMT time zone

No problem. Edit /etc/TIMEZONE and change TZ= to read: TZ=GMT+3. Since your application tries to interpret TZ, you'll have to ask your vendor what an acceptable TZ name would be for your country (applications shuld *not* be paying any attention to TZ). From now on, You can preview different TZ settings like this:

TZ=GMT+3 date
TZ=GMT date
TZ=GMT-3 date

As you will see, the date command (and all related time/date system calls) will translate the time from GMT. Once GMT+3 has been set, NOW you can now change time using the date command and HP-UX will set interpret what you type, subtract 3 hours and set the internal time to GMT. HP-UX time was set based on the value of TZ when the date command (to change time/date) was last issued.

The tztab file can be edited and any timezone can be added. Since timzones are political and not astrometric, this file is quite versatile. If you need daylight savings, you can use the comments in the tztab file as well as the tztab man page to create the required rules.

Note that daylight saving is defined (or not defined) by the TZ value. If you use GMT+3 then there is no daylight saving change. If you need daylight saving for some users, you'll need the details for your country on start dates and normal dates.

Now it's important to understand that TZ does *NOT* change time, only the representation. If you chage TZ while you are logged in, only the time for your shell and and child processes you run will be affected. SO for applications that are started automatically, the environment must be explicitly to make sure HP-UX knows how to translate time for the applcation.

As far as NTP goes, NTP *always* uses GMT, just like HP-UX. So there will never br a 'jump' in time. HP-UX will always count 86400 seconds every day. How time is displayed to a user or application is the function of TZ.


Bill Hassell, sysadmin
R. Allan Hicks
Trusted Contributor

Re: Change to GMT time zone

I did

TZ=WAT-3

did date and it showed showed GMT plus 3 hours for local time.

TZ name and -offset

So TZ=WAT3 says local time is 3 hours behind GMT. TZ=WAT-3 says local time is -(-3) or three hours ahead of GMT.

Time is kept in UTC, the offset is applied before it's displayed.


So.....
$ TZ=WAT-3
$ date
Mon Dec 22 16:53:24 WAT 2003
$ TZ=WAT3
$ date
Mon Dec 22 10:53:33 WAT 2003
$ date -u
Mon Dec 22 13:53:39 UTC 2003
$

If you put WAT3WDT, I think you enable DST. Not really sure.

Hope this helps. It's kinda lame, but I'm on vacation.


"Only he who attempts the absurd is capable of achieving the impossible
Bill Hassell
Honored Contributor

Re: Change to GMT time zone

WAT is undefined in /usr/lib/tztab and therefore, the value for TZ defaults to GMT. The same is true for: "TZ=YYY date" which is the same as "TZ=GMT date". Adding WDT to the end of WAT has no effect: "TZ=WATWDT date" which is understandable because there is no entry for WAT or WDT in /usr/lib/tztab.


Bill Hassell, sysadmin
Bill Hassell
Honored Contributor

Re: Change to GMT time zone

You can run without an entry for WAT or WDT like this:

TZ=WAT3WDT date

which works the same as:

TZ=YYY3YDT date

Since there is no entry for WAT or WDT, there won't be any action taken for daylight saving.



Bill Hassell, sysadmin