Commit 480aab08 authored by Nico Schallehn's avatar Nico Schallehn

Laufzeit fix 3

parent a7bcb3b5
...@@ -6,11 +6,7 @@ ...@@ -6,11 +6,7 @@
class MediaDBViewerAPI{ class MediaDBViewerAPI{
private $API_KEY; private $API_KEY;
private $API_start_time;
function __construct(){
$API_start_time = microtime(true);
}
function APIinit($KEY) { function APIinit($KEY) {
if(isset($KEY) AND strlen($KEY) == API_KEY_LEN){ if(isset($KEY) AND strlen($KEY) == API_KEY_LEN){
$API_KEY = $KEY; $API_KEY = $KEY;
...@@ -21,11 +17,11 @@ class MediaDBViewerAPI{ ...@@ -21,11 +17,11 @@ class MediaDBViewerAPI{
} }
return $ret; return $ret;
} }
function APIrespons($respons = ""){ function APIrespons($Laufzeit = 0, $respons = ""){
$stop = microtime(true);
return array( "API_VERSION"=> API_VERSION, return array( "API_VERSION"=> API_VERSION,
"API_KEY"=>$API_KEY, "API_KEY"=>$API_KEY,
"API_Laufzeit" =>($stop-$API_start_time), "API_Laufzeit" =>$Laufzeit,
"Antwort" => $respons ); "Antwort" => $respons );
} }
function error($ErrID){ function error($ErrID){
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* @author Nico Schallehn, Markus Then * @author Nico Schallehn, Markus Then
* *
*/ */
$beginn = microtime(true);
header('content-type: application/json; charset=utf-8'); header('content-type: application/json; charset=utf-8');
include 'api.class.php'; include 'api.class.php';
...@@ -25,5 +25,6 @@ else { ...@@ -25,5 +25,6 @@ else {
$respons = $API->error(1002); $respons = $API->error(1002);
} }
echo json_encode($API->APIrespons($respons),JSON_PRETTY_PRINT); $Laufzeit = microtime(true) - $beginn;
echo json_encode($Laufzeit, $API->APIrespons($respons),JSON_PRETTY_PRINT);
?> ?>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment