[Bps-public-commit] r19884 - Net-Google-Code/trunk/lib/Net/Google/Code

sunnavy at bestpractical.com sunnavy at bestpractical.com
Thu Jun 4 01:52:16 EDT 2009


Author: sunnavy
Date: Thu Jun  4 01:52:16 2009
New Revision: 19884

Modified:
   Net-Google-Code/trunk/lib/Net/Google/Code/DateTime.pm

Log:
make DateTime handle dates like 2009-06-01T13:00:10Z, also tweak the time_zone stuff

Modified: Net-Google-Code/trunk/lib/Net/Google/Code/DateTime.pm
==============================================================================
--- Net-Google-Code/trunk/lib/Net/Google/Code/DateTime.pm	(original)
+++ Net-Google-Code/trunk/lib/Net/Google/Code/DateTime.pm	Thu Jun  4 01:52:16 2009
@@ -23,19 +23,37 @@
     if (
         $base_date =~ /\w{3}\s+(\w+)\s+(\d+)\s+(\d\d):(\d\d):(\d\d)\s+(\d{4})/ )
     {
+        # Tue Jan  6 19:17:39 2009
         my $mon = $1;
         my $dom = $2;
         my $h   = $3;
         my $m   = $4;
         my $s   = $5;
         my $y   = $6;
-        return   $class->new(
+        my $date = $class->new(
             year   => $y,
             month  => $MONMAP{$mon},
             day    => $dom,
             hour   => $h,
             minute => $m,
-            second => $s
+            second => $s,
+            time_zone => '-0700', # google's time zone
+        );
+        $date->set_time_zone( 'UTC' );
+        return $date;
+    }
+    elsif ( $base_date =~ /(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})Z/ )
+    {
+
+        #    2009-06-01T13:00:10Z
+        return $class->new(
+            year      => $1,
+            month     => $2,
+            day       => $3,
+            hour      => $4,
+            minute    => $5,
+            second    => $6,
+            time_zone => 'UTC',
         );
     }
 }



More information about the Bps-public-commit mailing list