Operating System - HP-UX
1827881 Members
1355 Online
109969 Solutions
New Discussion

Daylight Saving Time Simple Question

 
SOLVED
Go to solution
Peter Chokola
Occasional Advisor

Daylight Saving Time Simple Question

This is not a year 2007 specific question. I am installing some new severs (and I need to fix some others) with regards to time zones. When installing a new server from the CD's (HP-UX 11i v1), I would like to set the time zone to Central Standard Time, but that is not an option. The only option is CST6CDT, which switches from CST to CDT, which is NOT what I want. I want the time to always be CST. Our existing servers are set to CST6 and it works exactly the way I want it to.
So my question is 1) Is CST6 the proper setting for Central Standard Time? and 2) How do I change it on the server if it is not an option?
6 REPLIES 6
A. Clay Stephenson
Acclaimed Contributor
Solution

Re: Daylight Saving Time Simple Question

Yes, if you set TZ=CST6 then the time will always be 6 hours after UTC. Manually edit /etc/TIMEZONE and insert this value and you are good to go. You should stop and restart the cron daemon after making this change but you will probably go through a number of reboots during an install that will restart cron implicitly.

NOTE: Should any of your user define their unique TZ value then it will take precedence over your system TZ setting -- just as it should because TZ actually only controls how time is displayed; the system simply counts seconds since 1-Jan-1970.

If it ain't broke, I can fix that.
Bill Hassell
Honored Contributor

Re: Daylight Saving Time Simple Question

> Is CST6 the proper setting for Central Standard Time?

The man page for environ tells everything about TZ. First, there is no proper setting. TZ can be anything you want. Set TZ=BILLH6 and you'll get exactly the same behavior as TZ=CST6 (man environ). The TZ value can be any 3 (or more) characters followed by the offset from UTC (aka, GMT) and that offset is not limited to hours. Here are some examples:

TZ=CST6CDT date
TZ=CST6 date
TZ=BILLH5 date
TZ=SILLY8:35:26 date

In these examples, the TZ variable is set temporarily for the date command so you see the result. That's the beauty of the TZ variable -- it controls the representation of the kernel's time (which is always GMT, no daylight saving time).

The /usr/lib/tztab is a shorthand way to track the past, present and future time changes. The CDT extension is just an additional but optional rule. However TZ doesn't have to be set to any of those rules. Define TZ as you want it, edit /etc/TIMEZONE and now everyone will see the new time. Be sure to reboot sometime so kernel processes and daemons will see the same TZ value. And TZ is very versatile. Each user can have their own TZ value so logins can be customized for users all over the world.


Bill Hassell, sysadmin
BUPA IS
Respected Contributor

Re: Daylight Saving Time Simple Question

Hello,

Adding an entry like this to /usr/lib/tztab will enable the default display of time as you wish, and set /etc/TIMEZONE to match
CST6
0 1 1-7 3 2007-2038 0 CST6

N.B. keep a copy of this entry so you can put it back since hp patching will overwrite this file from time to time.
As the others indicate the TZ variable controls the time display in a shell.
In order to get the kernel routine time stamps to come out the same way (since they do not use the TZ variable especially at boot time), set the timzone kernel parameter to 360 (6 hours west of Greenwich, the supplied default is 420 PST )
and if you do not want the default time display to change each spring and autumn you may set the dst kernel parameter to 0

Mike
Help is out there always!!!!!
Dennis Handly
Acclaimed Contributor

Re: Daylight Saving Time Simple Question

>Mike: Adding an entry like this to /usr/lib/tztab

There is no need to create entries in tztab if they don't have DST. (Unless you just want to document it.) And why did you pick those particular values??

>Mike: N.B. keep a copy of this entry so you can put it back since hp patching will overwrite this file from time to time.

Adding this entry will prevent the file from being patched. :-(

>Mike: the supplied default is 420 PST)

No, that's MST.
Peter Chokola
Occasional Advisor

Re: Daylight Saving Time Simple Question


As Clay mentions, this will do what I want.

"Yes, if you set TZ=CST6 then the time will always be 6 hours after UTC."

Thanks for all the help.
Peter Chokola
Occasional Advisor

Re: Daylight Saving Time Simple Question

Closed.