- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- How does TZ get set?
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-09-2005 02:48 AM
09-09-2005 02:48 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-09-2005 02:53 AM
09-09-2005 02:53 AM
Re: How does TZ get set?
Assuming a Posix shell, when /etc/profile is sourced during login, /etc/TIMEZONE is sourced (if avaailable).
In turn, /etc/TIMEZONE is intended to contain the default TZ variable.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-09-2005 02:53 AM
09-09-2005 02:53 AM
Re: How does TZ get set?
Follow-up question:
looking at /usr/lib/tztab I don't find a category for explicitly CST6. Namely, I find this:
# Central Standard Time, Central Daylight Time
CST6CDT
0 3 24-30 4 1970-1973 0 CDT5
0 3 6 1 1974 0-6 CDT5
0 3 22-28 2 1975 0 CDT5
0 3 24-30 4 1976-1986 0 CDT5
0 3 1-7 4 1987-2038 0 CDT5
0 1 25-31 10 1970-1973 0 CST6
0 1 24-30 11 1974 0 CST6
0 1 25-31 10 1975-2038 0 CST6
If TZ=CST6, how does or when does a daylight savings time change occur? Never? Thanks.
Why I ask. The time flopped back an hour on one of our HP-UX 10 boxes. I am trying to find the cause.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-09-2005 02:56 AM
09-09-2005 02:56 AM
Re: How does TZ get set?
set_parms timezone
or modify /etc/defaults/tz (this may require a reboot to take effect - I do not know)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-09-2005 02:57 AM
09-09-2005 02:57 AM
Re: How does TZ get set?
That time server may be off or non-standard, thoght the change would not be sudden in this case, it would be very gradual.
I would run through /etc/profile and .profile and stuff and look for source that might be altering the TZ variable. Its probably a pecularity of this box.
If you change the TIMEZONE parameter it should solve the problem, though a manual time zone adjust ment may be needed.
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-09-2005 07:02 AM
09-09-2005 07:02 AM
SolutionQ: So where do all these timezones come into play?
ANS: Through the standard Unix libraries and commands. Whether you run the date command or use libary calls like ctime(), etc, the environment value of TZ is checked and then based on the rules in /usr/lib/tztab (or if not found in tztab, the rules found in the environ man page) will be applied to the UTC system time and time (possibly date) translated accordingly.
Since CST6 is not found in tztab, the man page for environ says that when TZ=CST6, 6 hours must be added to match UTC time. And since there is no daylight saving part, then no daylight saving rule will be observed. So just change /etc/TIMEZONE to read:
TZ=CST6CDT
export TZ
Now each user that logs in will see Central time including the apparent jump for daylight saving. So TZ is merely a translator and never changes the system time. only it's representation.
What about /etc/defaults/tz? This is a relatively recent patch (PHCO_31927) which also needs an updated libc patch. Read the description for PHCO_31927 for the details. Note that set_parms timezone just edits /etc/TIMEZONE, so you can do this at anytime. When this file changes, nothing is changed for existing logins--users must login again to get the new value.
As far as NTP, it will never change the time an hour forward or backward. NTP is based on UTC and does not do anything about daylight saving. So when you see the time 'jump', unless a root user has changed the time (a VERY bad idea on any production server), the TZ value has likely changed. To see this, type these commands to see how TZ affects the date command:
TZ=CST6 date
TZ=CST6CDT date
TZ=EST5EDT date
TZ=GMT0 date
TZ=NST3:30NDT date
TZ=CST-9:30CDT date
TZ=BILLH1:23 date
Notice that the date/time is displayed differently depending on the setting for TZ. UTC is always 6 hours ahead of CST6 year 'round, but CST6CDT will observe the rules in tztab. EST5EDT is the standard Eastern timezone with EDT observance. GMT0 is the same as UTC time.
Now for some fun: NST3:30NDT is for Newfoundland where there is a 30 minute (not 60 minute) change for daylight saving. And CST-9:30CDT is for South Australia and the offset is negative (-9:30). And the last is to demonstrate the versatility of the HP-UX TZ variable--I've created my own timezone!! According to the man page for environ, 3 (or more) bytes define the name, followed by the offset that must be added to local time to match UTC. So my special timezone says that UTC is 1 hour and 23 minutes behind UTC.
As you may already know, timezones have virtually nothing to do with geography and astronomy--they are purely political and subject to the whims of government. The good news is that HP-UX can accomodate those whims.
The /etc/default/tz file is used to help define the default TZ value when it is not defined (for instance, in /etc/inittab). The rules are:
1) if the environment variable TZ is present, it takes precedence.
2) if TZ is not present, then the value contained in /etc/default/tz is used for the default TZ.
3) if /etc/default/tz is not present, then the default TZ value is equivalent to EST5EDT (Eastern Standard Time) of US.
Bill Hassell, sysadmin