Operating System - HP-UX
1833861 Members
1957 Online
110063 Solutions
New Discussion

Re: How to know if tztab is correctly handling time change?

 
SOLVED
Go to solution
Steve Start
Advisor

How to know if tztab is correctly handling time change?

Hi,

After looking at the man page for the date program, I saw a reference for tztab. I looked at /usr/lib/tztab and it appears to be correct. Is there a program to run that will test tztab. I don't want my crons to fail when the time changes or reports to display the wrong times.

Thanks in advance,
Steve
3 REPLIES 3
A. Clay Stephenson
Acclaimed Contributor
Solution

Re: How to know if tztab is correctly handling time change?

Well, first of all (assuming that you have reasonably new patches for cron appropriate to your OS), you don't need to do anything about your crontab entries. Cron handles the time changes unambiguously. Secondly, there is no single timezone for a given UNIX environment (except by accident); every user (actually every process) could have a unique TZ.

Still to answer your question, use the attached Perl script, dst.pl. dst.pl -n will display the next time change according to the current TZ setting. It use the underlying strftime() function that the date command uses; so if it works, your reports should work as well.

If it ain't broke, I can fix that.
Michael Tully
Honored Contributor

Re: How to know if tztab is correctly handling time change?

As far as I know tztab should work correctly. If there has been manual changes made, then these could be a problem. Don't forget the system actually runs from GMT (UTC) with an adjustment made from the local $TZ
Check that the entries are correct with your TZ and also that the /etc/profile and /etc/TIMEZONE have the correct entries. cron get's it time from the local $TZ of the server, or from the script or program that is being run.
Anyone for a Mutiny ?
A. Clay Stephenson
Acclaimed Contributor

Re: How to know if tztab is correctly handling time change?

Oh, I should add:

TZ=CST6CDT dst.pl -n
TZ=EST5EDT dst.pl -n

will check the Central and Eastern (US) Timezones. Note the whitespace before the dst.pl command.
If it ain't broke, I can fix that.