[Bps-public-commit] net-lighthouse branch, master, updated. 24ca40b4b0520c6df03c9353cdd78769ab1a0eda

sunnavy at bestpractical.com sunnavy at bestpractical.com
Mon Aug 31 08:10:00 EDT 2009


The branch, master has been updated
       via  24ca40b4b0520c6df03c9353cdd78769ab1a0eda (commit)
      from  d85b0762dc723f39eb222f016c856cf50a12fc3b (commit)

Summary of changes:
 lib/Net/Lighthouse/Util.pm |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

- Log -----------------------------------------------------------------
commit 24ca40b4b0520c6df03c9353cdd78769ab1a0eda
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Mon Aug 31 20:09:48 2009 +0800

    handle non utc datetime format

diff --git a/lib/Net/Lighthouse/Util.pm b/lib/Net/Lighthouse/Util.pm
index c4b85dd..a6d2058 100644
--- a/lib/Net/Lighthouse/Util.pm
+++ b/lib/Net/Lighthouse/Util.pm
@@ -52,19 +52,21 @@ sub datetime_from_string {
     my $class  = shift;
     my $string = shift;
     if (   $string
-        && $string =~ /(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})Z/ )
+        && $string =~
+        /(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(Z|[+-]\d{2}:\d{2})/ )
     {
 
         #    2009-06-01T13:00:10Z
-        return DateTime->new(
+        my $dt = DateTime->new(
             year      => $1,
             month     => $2,
             day       => $3,
             hour      => $4,
             minute    => $5,
             second    => $6,
-            time_zone => 'UTC',
+            time_zone => $7 eq 'Z' ? 'UTC' : $7,
         );
+        $dt->set_time_zone( 'UTC' );
     }
 }
 

-----------------------------------------------------------------------



More information about the Bps-public-commit mailing list