Zefram wrote:
>[EMAIL PROTECTED] wrote:
> >How do I compute the number of hours in a day in a specific time zone?
> 
> Try this:

Thanks for the working example. It's helpful.

> It ought to be possible to do the interval calculation using
> DateTime::Duration instead of ->epoch, but the behaviour of DT::D is
> unreasonably confusing and I couldn't get it to work.  (Strangely, I got
> a version that worked fine for America/New_York, where all the days are
> integer numbers of hours, but lost the fractional hour of 2007-12-09 in
> America/Caracas, which was 24.5 hours long.)
>
> Beware that the above code assumes that
> midnight exists every day.  We recently had a thread
> <http://www.nntp.perl.org/group/perl.datetime/2008/10/msg7086.html> about
> midnight not existing in some timezones, specifically America/Sao_Paulo.

It's funny you should mention that thread. It's what inspired my little 
exercise, which I thought was going to be easier than it is. Here's what I 
*really* want to do:

I want to iterate the time zones of the world to generate a report of all days 
that aren't exactly 24 hours. I want to handle America/Caracas and 
America/Sao_Paulo correctly. You mentioned 2007-12-09 was 24.5 hours long in 
Venezuela. This is precisely the kind of outliers I'm after.

So I'm looking for the best, most canonical, most 
true-to-the-spirit-of-DateTime way to accomplish this using, presumably, 
DateTime::Duration and possibly DateTime::Format::Duration.

Jim Monty

Reply via email to