datetime question
Hi Dave, I have been using your module DateTime for a while, and I would like to thank you sincerely for creating this helpful tool! The sites I am using it for are http://www.zebramap.com/ and http://www.mytimezonemap.com/ I have been using caches for the searches for a while, and now of course we are in the middle of DST changes so I would like to ask you a question about that if you don't mind. Is there a way to retrieve the next switchover time for a time zone? I could then store that in the cache and stop using that cache entry after that time, similar to how web browsers do that. Thanks again! Best regards, Guustaaf -- Guustaaf Damave Guustaaf.com
Re: datetime question
On Sunday, October 31, 2010 15:26:04 Guustaaf Damave wrote: Is there a way to retrieve the next switchover time for a time zone? I could then store that in the cache and stop using that cache entry after that time, similar to how web browsers do that. Your best bet is probably finding a way to query the TZ database directly to get this information. The C library calls don't directly support looking up the switchover so this might not be real easy to do. You can probably pull up the data from the raw or compiled zoneinfo files. http://en.wikipedia.org/wiki/Tz_database Some APIs exist for this in DateTime: http://search.cpan.org/dist/DateTime- TimeZone/lib/DateTime/TimeZone/OlsonDB.pm But one of the sentences in the docs says: USAGE-- Not yet documented. This stuff is a mess. Thanks again! Best regards, Guustaaf Regards, Matthew Hall
Re: datetime question
On Sun, 31 Oct 2010, Guustaaf Damave wrote: I have been using caches for the searches for a while, and now of course we are in the middle of DST changes so I would like to ask you a question about that if you don't mind. Is there a way to retrieve the next switchover time for a time zone? I could then store that in the cache and stop using that cache entry after that time, similar to how web browsers do that. The relevant information is all in the DateTime::TimeZone objects, but there's no API for getting at it. If someone would like to take a stab at coming up with a sane API for this, that'd be great. I think it'd be really useful. It might be better to just expose some of the rawer data from the timezone objects and put the high-level API into a new module we could call DateTime::Event::TimeZone. -dave /* http://VegGuide.org http://blog.urth.org Your guide to all that's veg House Absolute(ly Pointless) */