diff --git a/inc/HTTP/HTTPClient.php b/inc/HTTP/HTTPClient.php index 188390b91f..e1a61e7e51 100644 --- a/inc/HTTP/HTTPClient.php +++ b/inc/HTTP/HTTPClient.php @@ -162,7 +162,7 @@ public function post($url,$data){ * @author Andreas Gohr */ public function sendRequest($url,$data='',$method='GET'){ - $this->start = $this->time(); + $this->start = microtime(true); $this->error = ''; $this->status = 0; $this->resp_body = ''; @@ -583,7 +583,7 @@ protected function sendData($socket, $data, $message) { $written = 0; while($written < $towrite){ // check timeout - $time_used = $this->time() - $this->start; + $time_used = microtime(true) - $this->start; if($time_used > $this->timeout) throw new HTTPClientException(sprintf('Timeout while sending %s (%.3fs)',$message, $time_used), -100); if(feof($socket)) @@ -628,7 +628,7 @@ protected function readData($socket, $nbytes, $message, $ignore_eof = false) { if ($nbytes < 0) $nbytes = 0; $to_read = $nbytes; do { - $time_used = $this->time() - $this->start; + $time_used = microtime(true) - $this->start; if ($time_used > $this->timeout) throw new HTTPClientException( sprintf('Timeout while reading %s after %d bytes (%.3fs)', $message, @@ -675,7 +675,7 @@ protected function readData($socket, $nbytes, $message, $ignore_eof = false) { protected function readLine($socket, $message) { $r_data = ''; do { - $time_used = $this->time() - $this->start; + $time_used = microtime(true) - $this->start; if ($time_used > $this->timeout) throw new HTTPClientException( sprintf('Timeout while reading %s (%.3fs) >%s<', $message, $time_used, $r_data), @@ -724,7 +724,7 @@ protected function debug($info,$var=null){ * @param mixed $var */ protected function debugHtml($info, $var=null){ - print ''.$info.' '.($this->time() - $this->start).'s
'; + print ''.$info.' '.(microtime(true) - $this->start).'s
'; if(!is_null($var)){ ob_start(); print_r($var); @@ -741,20 +741,11 @@ protected function debugHtml($info, $var=null){ * @param mixed $var */ protected function debugText($info, $var=null){ - print '*'.$info.'* '.($this->time() - $this->start)."s\n"; + print '*'.$info.'* '.(microtime(true) - $this->start)."s\n"; if(!is_null($var)) print_r($var); print "\n-----------------------------------------------\n"; } - /** - * Return current timestamp in microsecond resolution - * - * @return float - */ - protected static function time(){ - return microtime(true); - } - /** * convert given header string to Header array *