Ed Perrone wrote: > I am working on an application where the user will input a > date, time, and location, and I will need to convert > that time into the equivalent GMT. > This means I will need to locate the input data within > one of the Olsen time zones in order to create and manipulate a > Date::Time object. > > Unfortunately, "city/province/nation" or "latitude/longitude" > don't seem to convert easily into the time zone names > used in Date::Time.
[snipped] I had a similar problem with developing tests for the sunrise module. There is no easy way to do a reverse lookup using DateTime/Olson, However, you can generate an offset value to use for your time conversion (based on Long./Lat). For every 15 degrees west of the prime meridian you will lose one hour, ( conversely every 15 degrees east you will gain one hour) so you can take the Longitude you receive and compute the offset. From there you can use the DateTime::TimeZone::offset_as_string method to generate a DateTime object. Using this method I'm not sure if the DateTime object will apply the DST conversion. To get a better idea of what I did please see the 01basic.t file (for the DateTime::Event::Sunrise module) I hope this helps. Ron Hill