On Fri, 23 Jul 2010, Elliot Merrony wrote:

To start from the beginning, I've been using the DT and DT:TZ modules for a world clock and want to add a feature which displays the time, date and effect of the next DST transition (if any) for each location.

The modules seem to allow me to do anything I could possibly imagine with times and time zones, except this. I realise I could test whether each location is on DST for every hour from now until 6 months ahead, but was hoping that there was a more elegant way of determining when the transition is.

Asking around, I was advised that the _rules attribute of an DateTime::TimeZone object returns an array of DateTime::TimeZone::OlsonDB::Rule objects which encode the start
and end of DST observances.

However, I'm now understanding from Dave's response to the bug that the _rules attribute neither is nor should be used for this purpose.

Any advice welcomed. Please bear in mind I'm a Perl beginner (I'm only using it due to the existence of these modules!) so apologies for any misunderstanding.

Basically, I think we could have a better API than returning the raw rules. Off the top of my head, I think a DateTime::Event module that let you ask for the next transition in a set would work well. Of course, that might still require opening up some chunk of the DT::TimeZone API, but I don't want to expose the raw _rules attribute directly.


-dave

/*============================================================
http://VegGuide.org               http://blog.urth.org
Your guide to all that's veg      House Absolute(ly Pointless)
============================================================*/

Reply via email to