diff --git a/src/Middlewares/TreblleMiddleware.php b/src/Middlewares/TreblleMiddleware.php index 7a3086e..abf32bf 100644 --- a/src/Middlewares/TreblleMiddleware.php +++ b/src/Middlewares/TreblleMiddleware.php @@ -71,11 +71,16 @@ public function terminate(Request $request, JsonResponse|Response|SymfonyRespons data: $this->factory->make( request: $request, response: $response, - loadTime: $_SERVER['REQUEST_TIME_FLOAT'] - ?? (defined('LARAVEL_START') ? LARAVEL_START : null) - ?? microtime(true), + loadTime: microtime(true) - $this->startTime(), ), projectId: self::$project ?? (string) config('treblle.project_id'), ); } + + private function startTime(): float + { + return $_SERVER['REQUEST_TIME_FLOAT'] + ?? (defined('LARAVEL_START') ? LARAVEL_START : null) + ?? microtime(true); + } }