Changeset 1749

Show
Ignore:
Timestamp:
10/14/06 15:01:48
Author:
miyagawa
Message:

use DateTime?::TimeZone? utility function in Plagger::Date to figure out offset string

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/plagger/lib/Plagger/Date.pm

    r1745 r1749  
    55use Encode; 
    66use DateTime::Format::Strptime; 
     7use DateTime::TimeZone; 
    78use UNIVERSAL::require; 
    89 
     
    4647 
    4748    if (defined $zone) { 
    48         use integer; 
    49         my $offset = $zone / 60; 
    50         my $sign; 
    51         if ($zone >= 0) { 
    52             $sign = '+'; 
    53         } else { 
    54             $sign = '-'; 
    55             $offset = -$offset; 
    56         } 
    57         my $hour   = $offset / 60; 
    58         my $minute = $offset % 60; 
    59         my $tz     = sprintf '%s%02d%02d', $sign, $hour, $minute; 
     49        my $tz = DateTime::TimeZone::offset_as_string($zone); 
    6050        $dt->set_time_zone($tz); 
    6151    }