- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- When does DST start?
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
03-12-2003 11:33 AM
03-12-2003 11:33 AM
I have been asked to come up with a way to determine if Daylight Saving Time begins during the coming weekend. The idea is that on Monday morning before the change happens that weekend, I would like to be able to send out notices. I have looked at /usr/lib/tztab but that seems very complicated to me. Any ideas out there?
TIA. Greg
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-12-2003 11:37 AM
03-12-2003 11:37 AM
Re: When does DST start?
Cheryl
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-12-2003 11:39 AM
03-12-2003 11:39 AM
SolutionI would have a cron job that runs each Monday morning that calls the following one minute perl snippet. It looks at the DST setting for today and 1 week later and compares them.
---------------------------
#!/usr/bin/perl -w
use strict;
use constant SECONDS_PER_DAY => (24 * 60 * 60);
use constant DAYS_PER_WEEK => 7;
my $epoch = time();
my $isdst = (localtime($epoch))[8];
$epoch += (DAYS_PER_WEEK * SECONDS_PER_DAY);
my $isdst2 = (localtime($epoch))[8];
printf("%d\n",$isdst2 - $isdst);
---------------------------
This will print "1" going from Standard Time to DST; "-1" going from DST to Standard Time; and "0" if no change.
That should get you started, Clay
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-12-2003 11:41 AM
03-12-2003 11:41 AM
Re: When does DST start?
DST starts the first Sunday of every April.
Cheryl
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-12-2003 11:42 AM
03-12-2003 11:42 AM
Re: When does DST start?
This isn't as mysterious as it first appears. The man pages for 'tztab(4)' give a good explanation.
For "Eastern Standard Time, Eastern Daylight Time" (where I reside), the next time change during the years 1987-2038 occurs on the first Sunday (day=0) of the 4th month (April) during the first seven days (1-7).
Looking at a calendar, this maps to Sunday, April 6, 2003.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-12-2003 11:42 AM
03-12-2003 11:42 AM
Re: When does DST start?
This does assume that TZ has been set and also if you have users in multiple timezones you might need a cronjob for each with appropriate TZ settings for each.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-12-2003 11:52 AM
03-12-2003 11:52 AM
Re: When does DST start?
Greg
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-12-2003 02:07 PM
03-12-2003 02:07 PM
Re: When does DST start?
If the exit status is 0, the script does nothing but if it is -1 or 1 it sends mail to the users.
Thanks everybody for your help.
Greg
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-12-2003 02:42 PM
03-12-2003 02:42 PM
Re: When does DST start?
Actually you should be able to 'trick' it into returning a DST change. Simply increase the $epoch value more than 1 week where the $epoch += (SECONDS_PER_DAY * DAYS_PER_WEEK) is. make it something like $epoch += (SECONDS_PER_DAY * DAYS_PER_WEEK * 8).
I would let the Perl script print the output and test that
because the shell is going to see an unsigned exit status in the range 0-255.