Operating System - HP-UX
1823149 Members
3676 Online
109647 Solutions
New Discussion юеВ

Re: TIMEZONE & Daylight Saving Time

 
SOLVED
Go to solution
Isaac_4
Frequent Advisor

TIMEZONE & Daylight Saving Time

Hi every body:

I want to solve the problem that I have with my HP-UX. every time with the TIME ZONE.

I am in Central America using the TIME ZONE TZ=CST6CDT according to the command env.

I need to know:

When they are the days and the hours change in summer and winter for my time zone?

That I should modify so that not ahead or do go back the hour in summer or winter?

I wait can help me

Thank you !!!


The time is gold
7 REPLIES 7
Patrick Wallek
Honored Contributor

Re: TIMEZONE & Daylight Saving Time

All these are configured in the tztab file.

# man tztab

for more information.
A. Clay Stephenson
Acclaimed Contributor
Solution

Re: TIMEZONE & Daylight Saving Time

HP-UX is rather unique in that the timechanges can be configured by the user by modifying the /usr/lib/tztab file. Man 4 tztab for details.

The good news is that I have a Perl script which will ask the system for you and it uses the same functions as the date command and localtime() related functions do.

All you have to do is:
dst.pl

That will display the exact seconds before and after each time change for the ciurrent year. Invoke it as dst.pl -u for full usage. If you have one of the free Perl's installed on a Windows box, it will even work on them as well.

If it ain't broke, I can fix that.
A. Clay Stephenson
Acclaimed Contributor

Re: TIMEZONE & Daylight Saving Time

I should also add that because a UNIX box could have users connected all over the world, if you need to test for other TZ's then simply set and export TZ before executing the Perl script or you can set it for just one execution like this:

TZ=EST5EDT dst.pl

If it ain't broke, I can fix that.
Isaac_4
Frequent Advisor

Re: TIMEZONE & Daylight Saving Time

hi:

And what time the server change hour
at the 12:59 Pm or 1:59 AM ?

How I interpret the the file tztab?

Thank you !!!
The time is gold
A. Clay Stephenson
Acclaimed Contributor

Re: TIMEZONE & Daylight Saving Time

Download the Perl script and execute it. It will tell you exactly on YOUR system. We have no way of knowing if someone has altered the tztab or what TZ's are actually in effect. Ask the system itself; that's what dst.pl does.
If it ain't broke, I can fix that.
A. Clay Stephenson
Acclaimed Contributor

Re: TIMEZONE & Daylight Saving Time

Here is the output of dst.pl on one of my systems with TZ=CST6CDT BUT because someone may have altered your CST6CDT tztab entry, you should execute it on your box after detaching it.

$ echo ${TZ}
CST6CDT
$ perl dst.pl -y 2005
Sun Apr 03 01:59:59 CST 2005 --> Sun Apr 03 03:00:00 CDT 2005
Sun Oct 30 01:59:59 CDT 2005 --> Sun Oct 30 01:00:00 CST 2005
$

Notice that it shows you both transitions for 2005.
If it ain't broke, I can fix that.
Bill Hassell
Honored Contributor

Re: TIMEZONE & Daylight Saving Time

When you need a unique timezone, start by finding out the rules for your location. If your area does use Daylight Saving changes, then you can make up your own timezone. The secret to doing this is found in the man pages for environ and tztab. So if you're in Panama and there is no entry for Panama, you can create a TZ value = PAN6 or even PANAMA6. The first 3 or more letters are arbitrary, the next number is the hours of offset from GMT (Zulu) time. Since Panama is 6 hours away from GMT and does not observe summer time (Daylight Saving Time), that's all you need.

To make the change work for everyone, edit the file /etc/TIMEZONE:

TZ=PANAMA6
export TZ

The key is that HP-UX never changes timezones, it is always GMT. The TZ value simply adjusts how it is displayed or interpreted.


Bill Hassell, sysadmin