[tz] How to compute the moment of the next DST change
John Hawkinson
jhawk at mit.edu
Tue Apr 2 09:02:05 UTC 2013
Simon Perreault <simon.perreault at viagenie.ca> wrote on Tue, 2 Apr 2013
at 10:58:49 +0200 in <515A9DC9.8020009 at viagenie.ca>:
> I want to write a cron job or similar that activates one week prior
> to daylight saving time changes. (Or, more generically, one week
> prior to any time jumps, for any reason, DST or else.)
In casual interactive usage, I use the following, where 2014 is
the subsequent calendar year:
$ zdump -c 2014 -v US/Eastern | tail
US/Eastern Sun Mar 11 06:59:59 2012 UTC = Sun Mar 11 01:59:59 2012 EST isdst=0
US/Eastern Sun Mar 11 07:00:00 2012 UTC = Sun Mar 11 03:00:00 2012 EDT isdst=1
US/Eastern Sun Nov 4 05:59:59 2012 UTC = Sun Nov 4 01:59:59 2012 EDT isdst=1
US/Eastern Sun Nov 4 06:00:00 2012 UTC = Sun Nov 4 01:00:00 2012 EST isdst=0
US/Eastern Sun Mar 10 06:59:59 2013 UTC = Sun Mar 10 01:59:59 2013 EST isdst=0
US/Eastern Sun Mar 10 07:00:00 2013 UTC = Sun Mar 10 03:00:00 2013 EDT isdst=1
US/Eastern Sun Nov 3 05:59:59 2013 UTC = Sun Nov 3 01:59:59 2013 EDT isdst=1
US/Eastern Sun Nov 3 06:00:00 2013 UTC = Sun Nov 3 01:00:00 2013 EST isdst=0
US/Eastern Mon Jan 18 03:14:07 2038 UTC = Sun Jan 17 22:14:07 2038 EST isdst=0
US/Eastern Tue Jan 19 03:14:07 2038 UTC = Mon Jan 18 22:14:07 2038 EST isdst=0
$
So that is one starting point.
--jhawk at mit.edu
John Hawkinson
> Any pointers?
>
> I have looked at the usual places: POSIX time functions, various
> date/time modules on CPAN, etc. Nothing seems to do that
> computation. Do I need to parse the tz database myself?
More information about the tz
mailing list