Skip to content

Commit

Permalink
Reverse conditional since the offset is returned cast as a string.
Browse files Browse the repository at this point in the history
  • Loading branch information
mrubinsk committed Mar 28, 2014
1 parent bb8c518 commit 42f72dc
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions framework/Service_Weather/lib/Horde/Service/Weather/Station.php
Expand Up @@ -61,14 +61,18 @@ public function __set($property, $value)
*/
public function getOffset()
{
if (!empty($this->tz) && is_string($this->tz)) {
$d = new Horde_Date(time(), 'UTC');
$d->setTimezone($this->tz);
return $d->tzOffset();
} elseif (!empty($this->tz)) {
// tz is provided as an offset already.
if (!empty($this->_properties['tz']) && is_numeric($this->_properties['tz'])) {
return $this->tz;
} elseif (!empty($this->_properties['tz'])) {
try {
$d = new Horde_Date(time(), 'UTC');
$d->setTimezone($this->tz);
return $d->tzOffset();
} catch (Horde_Date_Exception $e) {
}
}

return false;
}

}

0 comments on commit 42f72dc

Please sign in to comment.