- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- allowable settings for /etc/default/tz
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
07-28-2009 06:51 AM
07-28-2009 06:51 AM
What are the allowable settings for /etc/default/tz or $TZ?
I would assume any setting defined in /usr/lib/tztab but the following leaves me puzzled.
/etc/default/tz is set to "AST4ADT#Canada" but I get different results after varying TZ:
The date command returns a time 3 hours ahead after setting TZ to "Canada/Atlantic" which is not listed in /usr/lib/tztab. I would think that date used the default EST5EDT (but I can't figure the difference in hours).
On the other hand, the date command returns a correct time when TZ is set at "Etc/GMT+3" which is also not listed in /usr/lib/tztab.
here is the actual output:
$ cat /etc/default/tz
AST4ADT#Canada
$ date
Tue Jul 28 11:20:58 Etc/GMT 2009
$ TZ=Canada/Atlantic
$ date
Tue Jul 28 14:21:26 Canada/Atlantic 2009
$ TZ=AST4ADT#Canada
$ date
Tue Jul 28 11:22:38 ADT#Canada 2009
$ TZ=Etc/GMT+3
$ date
Tue Jul 28 11:35:05 Etc/GMT 2009
$
So where can I find all the allowable values.
Thanks
RayB
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-28-2009 07:11 AM
07-28-2009 07:11 AM
Re: allowable settings for /etc/default/tz
http://www.docs.hp.com/en/B2355-60130/security.4.html
Try man /etc/default/tz
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
07-28-2009 08:38 AM
07-28-2009 08:38 AM
SolutionThe format of /etc/default/tz is exactly the same as with the /etc/TIMEZONE file, but without the "TZ=" prefix.
/etc/TIMEZONE is just a one-line shell script that sets the TZ environment variable to the desired value.
The TZ variable overrides /etc/default/timezone, if both are set.
The full syntax of the TZ environment variable (and therefore also the syntax of /etc/TIMEZONE and /etc/default/tz) is described in "man environ".
The basic structure of the TZ value is
The # sign and anything after that is a comment in the tztab file, and should not be included in the actual timezone setting. If you include it, it just makes the timezone identifier look ugly when the DST is in effect.
The timezone ID and the optional DST ID must be at least three characters long, but may be longer.
The UTC offset is defined in the POSIX standards as "the value you must add to the local time to get the UTC time". This is written so that the sign of the value becomes positive in North America, but it makes the sign work in a counter-intuitive way.
If your timezone does not use Daylight Saving Time, you are free to invent your own timezone ID if necessary. In that case, the timezone ID has no special meaning to the system: the system only cares about the UTC offset.
But if your timezone uses DST, then the entire TZ value (the combination of timezone ID, UTC offset and DST ID) must match one of the DST rule sets specified in /usr/lib/tztab.
If you need DST and there is no suitable DST rule set for your timezone in /usr/lib/tztab, feel free to read "man tztab" and write your own.
In your original situation, you show that /etc/default/tz is "AST4ADT#Canada", but I guess the TZ environment variable is also set to TZ=Etc/GMT+3 and it overrides /etc/default/tz.
When you set TZ=Canada/Atlantic, it apparently gets interpreted as UTC offset of zero, as there is no number at all in the TZ value.
TZ=AST4ADT#Canada apparently matches the tztab definitions, because it causes the difference of 3 hours, not 4. The system recognized that DST should be in effect and shifted the offset by one hour.
TZ=Etc/GMT+3 is a counter-intuitive one: it says the name of the timezone is "Etc/GMT" (which would mean essentially equivalent to UTC, right?) but "+3" means "add 3 hours to local time to get UTC", so the human-readable timezone definition would actually be "UTC-3 hours".
MK
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-28-2009 08:46 AM
07-28-2009 08:46 AM
Re: allowable settings for /etc/default/tz
Right, see tztab(4).
Why do you care about /etc/default/tz? TZ should always be set either by /etc/TIMEZONE or each user's .profile.
If your timezone doesn't have DST, you can make your own timezones. Seen environ(5) and TZ.
>I get different results after varying TZ:
If you set TZ, it doesn't look at /etc/default/tz.
>The date command returns a time 3 hours ahead after setting TZ to "Canada/Atlantic" which is not listed in /usr/lib/tztab.
tzset(3) says it uses UTC, when you have garbage input.
>MK: TZ=Etc/GMT+3 is a counter-intuitive one: it says the name of the timezone is "Etc/GMT" (which would mean essentially equivalent to UTC, right?)
Right, you shouldn't use GMT in your timezone unless you are GMT0.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-28-2009 11:32 AM
07-28-2009 11:32 AM
Re: allowable settings for /etc/default/tz
I was wondering where timezone_id and DST_id were defined (or which values were allowed)... they are not, you define them yourself.
My problem started with the installation of an Oracle Enterprise Manager agent.
For some reason, we couldn't get it running using TZ=AST4ADT#Canada which is our system setting. We use Etc/GMT+3 in the user profile as a workaround but will probably have to change it come fall due to DST switch.
Oracle does support "Canada/Atlantic" but we get error messages for "invalid offset between the agent and repository" when we try to use it in the agent configuration.
I'll pursue Oracle for a permanent solution.
Thanks all
RayB
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-28-2009 11:35 AM
07-28-2009 11:35 AM