name; $matches=0; if(preg_match("/^time:(.*)$/",$targetstring,$matches)) { $timezone = $matches[1]; $timezone_l = strtolower($timezone); $timezone_identifiers = DateTimeZone::listIdentifiers(); foreach ($timezone_identifiers as $tz) { if(strtolower($tz) == $timezone_l) { debug ("Time ReadData: Timezone exists: $tz\n"); $dateTime = new DateTime("now", new DateTimeZone($tz)); $item->add_note("time_time12",$dateTime->format("h:i")); $item->add_note("time_time12ap",$dateTime->format("h:i A")); $item->add_note("time_time24",$dateTime->format("H:i")); $item->add_note("time_timezone",$tz); $data[IN] = $dateTime->format("H"); $data_time = time(); $data[OUT] = $dateTime->format("i"); $matches++; } } if($matches==0) { warn ("Time ReadData: Couldn't recognize $timezone as a valid timezone name [WMTIME02]\n"); } } else { // some error code to go in here warn ("Time ReadData: Couldn't recognize $targetstring \n"); } debug ("Time ReadData: Returning (".($data[IN]===NULL?'NULL':$data[IN]).",".($data[OUT]===NULL?'NULL':$data[OUT]).",$data_time)\n"); return( array($data[IN], $data[OUT], $data_time) ); } } // vim:ts=4:sw=4: ?>
weathermap |
Subversion Repositories: |
Line No. | Rev | Author | Line |
---|