Re: Win32 help for DT::TimeZone
Here's my guess... # Failed test 'Kamchatka Standard Time - found valid Olson time zone from Windows' # at t\19local-win32.t line 115. # Failed test 'Paraguay Standard Time - found valid Olson time zone from Windows' # at t\19local-win32.t line 115. # Failed test 'UTC - found valid Olson time zone from Windows' # at t\19local-win32.t line 115. It looks like these timezones are missing from %WinToOlson in DateTime::TimeZone::Local::Win32. Need to add the following to the above hash: 'Kamchatka Standard Time' => 'Asia/Kamchatka', 'Paraguay Standard Time' => 'America/Asuncion', 'UTC' => 'UTC', Jim Brunette P.S. I did not test the above. (I am using ActivePerl, not sure how it runs or reports its tests.) Dave Rolsky wrote: > http://www.nntp.perl.org/group/perl.cpan.testers/2009/09/msg5285650.html > > Anyone care to take a stab at figuring that out? > > > -dave > > /* > http://VegGuide.org http://blog.urth.org > Your guide to all that's veg House Absolute(ly Pointless) > */ >
Re: Timezone lookup?
Ted Byers wrote: > On Thu, Aug 6, 2009 at 10:39 PM, J. Shirley wrote: > >> On Thu, Aug 6, 2009 at 7:27 PM, Jim Brunette wrote: >> >> >>> Is there a lat/lon database that contains the timezone boundaries? >>> >>> With a lat/long TZ DB, users could input their city or zip (or heck, if >>> they know it, their lat/lon), then the app would associate the user's >>> lat/lon with the TZ lat/lon and output the TZ (if the user's lat/lon was >>> not found, the app would just fall back to the continent/city names). >>> >>> To take it one step further, mobile apps with GPS have real-time >>> lat/lon, so getting the TZ should be easy... How useful such an mobile >>> app would be is another question. >>> >>> Jim >>> >>> >>> >>> >>> >>> >>> >> geonames.org provides this, via a simple HTTP interface. >> >> Here's a blog post describing usage: >> http://vancouverwebconsultants.com/getting-time-zone-from-latitude-longitude/(though >> in PHP) >> >> To fetch, it's very simple: >> http://ws.geonames.org/timezone?lat=$lat&lng=$lng >> >> -J >> >> > Well live and learn. Use someone else's hardware and software to do > the heavy lifting. ... ;-) > > I'll have to check it out. It is trivial to write Perl that is > equivalent to a given PHP code snippet. ;-) > > Thanks > > Ted > > Talk about embarrassing, I already use geonames.org's find* web services for geocoding--did not look farther down their web services list. Thanks a bunch, Jay. Jim
Re: Timezone lookup?
Is there a lat/lon database that contains the timezone boundaries? With a lat/long TZ DB, users could input their city or zip (or heck, if they know it, their lat/lon), then the app would associate the user's lat/lon with the TZ lat/lon and output the TZ (if the user's lat/lon was not found, the app would just fall back to the continent/city names). To take it one step further, mobile apps with GPS have real-time lat/lon, so getting the TZ should be easy... How useful such an mobile app would be is another question. Jim
DateTime::Format::ISO8601 and 2009-W01-1
Hello, I am using DateTime::Format::ISO8601-0.06 (perl, v5.10.0 built for i686-linux-thread-multi-64int-ld). When I try to parse '2009-W01-1', I get an following error: The "'day_of_year' parameter ("-2") to DateTime::from_day_of_year did not pass the 'is between 1 and 366' callback ... DateTime::from_day_of_year(undef, 'day_of_year', -2, 'year', 2009)" 2009-W01-1 should parse to 2008-12-29. Matrix of dates for 2009-W01-x: 2009-W01-1 = Err (days = -2) should be 2008-12-29. 2009-W01-2 = Err (days = -1) should be 2008-12-30. 2009-W01-3 = Err (days = 0) should be 2008-12-31. 2009-W01-4 = OK (days = 1) 2009-01-01. #First Thursday of 2009 2009-W01-5 = OK (days = 2) 2009-01-02. 2009-W01-6 = OK (days = 3) 2009-01-03. 2009-W01-7 = OK (days = 4) 2009-01-04. Just a guess, but it looks like if the days are <= 0, the day_of_year parameter should be 365 (366:leap year) + days, and year should be the previous year (perhaps in _normalize_week()). Thanks, Jim $ perl -MDateTime -MDateTime::Format::ISO8601 -wle '$dtf = DateTime::Format::ISO8601->new; $dt = $dtf->parse_datetime( "2009-W01-1" ); print $dt->ymd("-")' The 'day_of_year' parameter ("-2") to DateTime::from_day_of_year did not pass the 'is between 1 and 366' callback at /usr/local/lib/perl5/site_perl/5.10.0/i686-linux-thread-multi-64int-ld/DateTime.pm line 589 DateTime::from_day_of_year(undef, 'day_of_year', -2, 'year', 2009) called at /usr/local/lib/perl5/site_perl/5.10.0/DateTime/Format/Builder/Parser/Regex.pm line 128 DateTime::Format::Builder::Parser::Regex::make('DateTime::Format::Builder::Parser::Regex=HASH(0x83dd9ac)', '2009-W01-1', undef, 'HASH(0x83ddce0)') called at /usr/local/lib/perl5/site_perl/5.10.0/DateTime/Format/Builder/Parser/generic.pm line 123 DateTime::Format::Builder::Parser::generic::__ANON__('DateTime::Format::ISO8601=HASH(0x837bd50)', '2009-W01-1', 'HASH(0x8067b44)') called at /usr/local/lib/perl5/site_perl/5.10.0/DateTime/Format/Builder/Parser.pm line 538 DateTime::Format::Builder::Parser::__ANON__('DateTime::Format::ISO8601=HASH(0x837bd50)', '2009-W01-1', 'HASH(0x8067b44)') called at /usr/local/lib/perl5/site_perl/5.10.0/DateTime/Format/Builder/Parser.pm line 443 DateTime::Format::Builder::Parser::__ANON__('DateTime::Format::ISO8601=HASH(0x837bd50)', '2009-W01-1') called at /usr/local/lib/perl5/site_perl/5.10.0/DateTime/Format/Builder/Parser.pm line 85 DateTime::Format::Builder::Parser::parse('DateTime::Format::Builder::Parser=HASH(0x83d3090)', 'DateTime::Format::ISO8601=HASH(0x837bd50)', '2009-W01-1') called at /usr/local/lib/perl5/site_perl/5.10.0/DateTime/Format/Builder.pm line 189 DateTime::Format::Builder::__ANON__('DateTime::Format::ISO8601=HASH(0x837bd50)', '2009-W01-1') called at -e line 1 (Should be: 2008-12-29) ... perl -MDateTime -MDateTime::Format::ISO8601 -wle '$dtf = DateTime::Format::ISO8601->new; $dt = $dtf->parse_datetime( "2009-W01-4" ); print $dt->ymd("-")' (OK) 2009-01-01