Operating System - HP-UX
1821052 Members
2221 Online
109631 Solutions
New Discussion юеВ

how to identify that daylight saving on my sever is off and how to enable daylight saving on HP-UX

 

how to identify that daylight saving on my sever is off and how to enable daylight saving on HP-UX

Dear all

i want to identify that daylight saving option is disabled or not on the HP-UX system and how to enable it if needed ,,,

when i run date and date -u commands on my system offer:
root# date
Sun Jul 2 14:11:01 BST 2006
root# date -u
Sun Jul 2 13:11:04 UTC 2006

what is the one hour difference between two commands

thanks for your corporation
Ayman
5 REPLIES 5
Steven E. Protter
Exalted Contributor

Re: how to identify that daylight saving on my sever is off and how to enable daylight saving on HP-UX

Shalom Ayman,

Assumming your server is where your profile says you live the following is true:

You can set the TZ parameter in your system with the variable TZ.

This will put you three hours ahead of GMT and time zone changes will occur automatically based on schedules for your time zone.

We have to set them manually here because our government changes the time zone dates every year or so.

UTC showin by your command is your time based on Universal time zone, which avoids geographic specifics. BST is your local time zone. One of those two times matches your clock on the wall and setting the TZ variable in /etc/profile will normalize display of time on your system.

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

Re: how to identify that daylight saving on my sever is off and how to enable daylight saving on HP-UX

thanks for contact
i want to tell you that my place is in Jordan , and the government teams vary to identify the daylight saving time from year to year ,,, i know that HP-UX installation put daylight saving feature as OFF , but if i want to activate it what must be doing ,,,

and i want to know the reason of difference between date and date -u commands
Bill Hassell
Honored Contributor

Re: how to identify that daylight saving on my sever is off and how to enable daylight saving on HP-UX

HP-UX knows nothing about timezones. It keeps the time of day in UTC (also known as Zulu or GMT time). When you type the command:

date -u

the current time in HP-UX is shown. The date command (and related system calls made by programs) translate the UTC time into whatever timezone you need. If you read the man page:

man environ

you will see that the TZ variable can be defined for anything you like, with or without daylight saving changes. In other words, HP-UX keeps the same time used by astronomers but will allow you to translate it to anyplace on earth.

Now to make this translation easier, there is a timezone table: /usr/lib/tztab which has popular timezones and rules to convert to daylight saving time. For Jordan, the timezone is EETDST-3 from the HP table. However, according to this reference:

http://www.timeanddate.com/worldclock/timezone.html?n=11

timezones and daylight saving may be more convoluted than the data in tztab. No problem! That's because you can define any new timezone you like, and specify the switch date, yearly if necessary. This is all done with the TZ variable (see the comments in tztab, and the man pages for environ and tztab.

To change your all your logins so they correspond to Jordan time, change the file:

/etc/TIMEZONE

to read:

TZ=EETDST-3
export TZ

This will show you the correct time for your timezone and date. NOTE: If someone set your time and date using BST rather than EETDST-3, then your computer clock was set incorrectly. You must set the time using the date command with the correct TZ value, or set the clock with date -u and give the computer the correct UTC (GMT) time.


Bill Hassell, sysadmin
A. Clay Stephenson
Acclaimed Contributor

Re: how to identify that daylight saving on my sever is off and how to enable daylight saving on HP-UX

And keep in mind that your computer may be connected to users around the world so that many TZ settings could be in play simultaneously. Attached is a Perl script that will test your TZ settings and your /usr/lib/tztab entries. It will display the exact second before and after each time transition.

Invoke as dst.pl -u for full usage.

You can also text "foreign" TZ settings by
asserting various TZ values on the command line e.g:
TZ=CST6CDT dst.pl -y 2007

The good news is that this Perl script using the same underlying libc date/time functions that applications and commands like date use so, if this is good then the commands are also good.
If it ain't broke, I can fix that.
Bill Hassell
Honored Contributor

Re: how to identify that daylight saving on my sever is off and how to enable daylight saving on HP-UX

One additional note about BST (British Summer Time). A 'normal' BST entry in /usr/lib/tztab. On a standard 11i installation, BST and UTC (or GMT0) show the same time right now. That's because BST does not have it's own entry, but is instead the daylight saving adjustment name for GMT0. The actual TZ name is not BST but should be GMT0BST. You can test this like this:

date -u
TZ=GMT0 date
TZ=BST date
TZ=GMT0BST date
TZ=EET-2EETDST date

The first 3 times will all show UTC (GMT) time. When TZ=GMT0BST, then you will see the time one hour ahead of GMT but if you use TZ=EET-2EETDST, then the time will be 3 hours ahead.

As mentioned previously, your computer time (date -u) may not be correct. This hapened when your computer was first setup because the current TZ value did not match the local offset. Ideally, all HP-UX computers would be initially setup with date -u to prevent this type of error. Once date -u is correct, then you can set the TIMEZONE file to match your local time.


Bill Hassell, sysadmin