[Phphtmllib-devel] SF.net SVN: phphtmllib:[3486] trunk/open2300/lib/modules/api/ AviationWeather.in
Status: Beta
Brought to you by:
hemna
From: <he...@us...> - 2010-06-17 03:27:04
|
Revision: 3486 http://phphtmllib.svn.sourceforge.net/phphtmllib/?rev=3486&view=rev Author: hemna Date: 2010-06-17 03:26:58 +0000 (Thu, 17 Jun 2010) Log Message: ----------- offset Modified Paths: -------------- trunk/open2300/lib/modules/api/AviationWeather.inc Modified: trunk/open2300/lib/modules/api/AviationWeather.inc =================================================================== --- trunk/open2300/lib/modules/api/AviationWeather.inc 2010-06-17 03:24:50 UTC (rev 3485) +++ trunk/open2300/lib/modules/api/AviationWeather.inc 2010-06-17 03:26:58 UTC (rev 3486) @@ -587,7 +587,7 @@ $info = array("Name" => $json->Airport->Name, "GeonameID" => $json->Airport->GeonameID, "Timezone" => $json->Airport->Timezone, - "TimezoneOffset" => get_timezone_offset($info->Timezone, "GMT"), + "TimezoneOffset" => $this->get_timezone_offset($info->Timezone, "GMT"), "Latitude" => $json->Airport->Latitude, "Longitude" => $json->Airport->Longitude); return $info; @@ -599,6 +599,21 @@ } } + + protected function get_timezone_offset($remote_tz, $origin_tz = null) { + if($origin_tz === null) { + if(!is_string($origin_tz = date_default_timezone_get())) { + return false; // A UTC timestamp was returned -- bail out! + } + } + $origin_dtz = new DateTimeZone($origin_tz); + $remote_dtz = new DateTimeZone($remote_tz); + $origin_dt = new DateTime("now", $origin_dtz); + $remote_dt = new DateTime("now", $remote_dtz); + $offset = $origin_dtz->getOffset($origin_dt) - $remote_dtz->getOffset($remote_dt); + return $offset; + } + } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |