On Tue, Dec 3, 2013, at 11:13 PM, Zefram wrote:
> Alfie John wrote:
> >I had a bit of trouble using timezones defined in the Olson etcetera
> >data file.
> 
> DT:TZ intentionally doesn't support them. 

The --old option to parse_olson shows that is some support for them, it
just doesn't do them correctly.

> It's not aiming to provide
> precisely the semantics of the Olson database, and you'll see they're
> not listed in DT:TZ:Catalog. 

Sorry, I've misunderstood the module then. I saw references to the Olson
database in DT::TZ's documentation, I was under the assumption that it
provided Olson timezones. If it doesn't aim to have mappings to all of
the Olson entries is there a reason not to provide mappings with my
patches? AFAICS it's only etcetera with valid zone data that is missing.

>  If you want to resolve zone names
> exactly as in the Olson database, use DateTime::TimeZone::Olson (a
> separate distribution).  If you want timezones of fixed offset, prefer
> DateTime::TimeZone::OffsetOnly over the Olson Etc/ names.

I unfortunately need exact mappings, so OffsetOnly isn't an option. I've
looked at DateTime::TimeZone::Olson, and it does what I want, but it
looks like there's a bug (POSIX sign flipping which I've fixed in my
patch to DateTime::TimeZone):

  #!/usr/bin/perl
                                                              
  use strict;
  use warnings;
  
  use DateTime::Format::ISO8601;
  use DateTime::TimeZone::Olson qw(olson_tz);
                                                                                
                                           
  my $dt
    = DateTime::Format::ISO8601
    ->parse_datetime('2013-12-03T23:39:11')
    ->set_time_zone('UTC');
                                                              
  print "$dt\n";
                                                              
  $dt->set_time_zone(olson_tz("Etc/GMT+10"));
  print $dt,"\n"; 

Expected output:

  2013-12-03T23:39:11
  2013-12-04T10:39:11

Actual output:

  2013-12-03T23:39:11
  2013-12-03T13:39:11

Alfie

-- 
  Alfie John
  alf...@fastmail.fm

Reply via email to