diff --git a/src/Internal/StopWatch.php b/src/Internal/StopWatch.php index a0e2a3c4..2a4cd172 100644 --- a/src/Internal/StopWatch.php +++ b/src/Internal/StopWatch.php @@ -18,22 +18,20 @@ /** @internal */ class StopWatch { - private function __construct(private readonly int $started) + private function __construct(private readonly float $started) { } public static function startNew(): self { - $now = DateTime::utcNow(); - $started = (int) \floor((float) $now->format('U.u') * 1000); + $started = microtime(true); return new self($started); } - public function elapsed(): int + public function elapsed(): float { - $now = DateTime::utcNow(); - $timestamp = (int) \floor((float) $now->format('U.u') * 1000); + $timestamp = microtime(true);; return $timestamp - $this->started; }