Fix weatherdotcom timeobjects - parsing back and forth like this is not needed..
authorMichael J. Rubinsky <mrubinsk@horde.org>
Sun, 18 Apr 2010 23:45:05 +0000 (19:45 -0400)
committerMichael J. Rubinsky <mrubinsk@horde.org>
Sun, 18 Apr 2010 23:45:05 +0000 (19:45 -0400)
timeobjects/lib/Driver/Weatherdotcom.php

index 4e10cbc..b2c1184 100644 (file)
@@ -48,7 +48,6 @@ class TimeObjects_Driver_Weatherdotcom extends TimeObjects_Driver
             //       Horde to set your current location, maybe with a google
             //       map?
         }
-
         if ($country != 'US') {
             $params['units'] = 'metric';
         }
@@ -180,9 +179,7 @@ class TimeObjects_Driver_Weatherdotcom extends TimeObjects_Driver
             throw new TimeObjects_Exception($location->getMessage());
         }
 
-        $date = strptime($forecast['update'], $prefs->getValue('date_format') . ' ' . ($prefs->getValue('twentyFour') ? '%H:%M' : '%I:%M %P'));
-        $day = new Horde_Date(gmmktime($date['tm_hour'], $date['tm_min'], $date['tm_sec'], $date['tm_mon'] + 1, $date['tm_mday'], $date['tm_year'] + 1900));
-
+        $day = new Horde_Date($forecast['update']);
         $objects = array();
         foreach ($forecast['days'] as $which => $data) {
             $day_end = clone $day;
@@ -258,7 +255,6 @@ class TimeObjects_Driver_Weatherdotcom extends TimeObjects_Driver
 
             $day->mday++;
         }
-
         return $objects;
     }