#!/usr/local/bin/perl -w ################## use DateTime::TimeZone; use Data::Dumper; my $tz = shift || 'America/New_York'; my $utc_start = DateTime::TimeZone::UTC_START(); my $utc_end = DateTime::TimeZone::UTC_END(); my $short_name = DateTime::TimeZone::SHORT_NAME(); my $tzobj = DateTime::TimeZone->new( name => $tz ); foreach my $span ( @{ $tzobj->{ 'spans' } } ) { my $start = RD->new( $span->[ $utc_start ], $tzobj, )->as_datetime; my $end = RD->new( $span->[ $utc_end ], $tzobj, )->as_datetime; print "$span->[ $short_name ]: $start - $end\n"; } package RD; use constant SECONDS_PER_DAY => 86400; sub new { my $class = shift; my $seconds = shift; my $timezone = shift; my $self = bless( [ $seconds, $timezone ], $class, ); return $self; } sub time_zone { shift->[1] } sub utc_rd_values { my ( $self ) = @_; my $days = int( $self->[0] / SECONDS_PER_DAY ); my $seconds = int( $self->[0] % SECONDS_PER_DAY ); return ( $days, $seconds, 0 ); } sub as_datetime { my ( $self ) = @_; if ( $self->[0] eq '-inf' ) { return DateTime::Infinite::Past->new; } if ( $self->[0] eq 'inf' ) { return DateTime::Infinite::Future->new; } return DateTime->from_object( object => $self ); }