1832895 Members
2660 Online
110048 Solutions
New Discussion

Time Change

 
SOLVED
Go to solution
John Chaff
Advisor

Time Change

Hello Gang,

I saw a thread earlier today that mentioned the upcoming time change. Is there a command that indicates when the time changes for a particular timezone? Maybe something that reads the tztab file?

Thanks,
John
5 REPLIES 5
Pete Randall
Outstanding Contributor

Re: Time Change

John,

You can look at the tztab file and the man page for it - it's pretty well explained right there.


Pete

Pete
A. Clay Stephenson
Acclaimed Contributor
Solution

Re: Time Change

First, note that the time change should be a complete non-event (except for us dumb humans). UNIX boxes don't care. There is no out-of-the-box command that will do what you want but I did write a Perl script that will do the trick. Invoke as dst.pl -u for full usage. It will even run on Windows boxes if you have Perl installed and it observes your TZ setting. Remember, a given box could have many TZ settings in play at any moment and all are equally valid.

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

Re: Time Change

Hi John,

There is a kernel parameter "dst" that enables / disables daylight saving time.

These two links should help you understand how the daylight saving time change happens on the system.

http://www1.itrc.hp.com/service/cki/docDisplay.do?docLocale=en_US&docId=200000068500534

http://www1.itrc.hp.com/service/cki/docDisplay.do?docLocale=en_US&docId=200000070865923

The doc ids are A5432015 & UCMDSKBRC00009530.

Hope this helps.

Regds
John Chaff
Advisor

Re: Time Change

Hello Gang,

Thanks for the quick replies! I just downloaded A. Clay's perl program and it was just what I wanted. I need to send emails to my users. I just need to set and export TZ before using the program for each group of users.

$ dst.pl -n
Sun Oct 31 01:59:59 EDT 2004 --> Sun Oct 31 01:00:00 EST 2004
$

This is a neat program!

Thanks again,
John

A. Clay Stephenson
Acclaimed Contributor

Re: Time Change

If it were me, rather than splitting the emails into groups, I would simply list all the timezones in play. A given human should be smart enough to determine which timezone(s) are applicable. We can also use a shell trick that bypasses the need for an explicit export.

TZ=EST5EDT dst.pl -n

Leveraging that technique:
TZS="EST5EDT CST6CDT MST7MDT PST8PDT"

for ZONE in ${TZS}
do
TZ=${ZONE} dst.pl -n
done

Just put in the TZ's that you need in TZS and it will output all the time changes.

There is also an option, '-d', to output the
days remaining until the time change which might prove useful.

If it ain't broke, I can fix that.