We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent eae7096 commit 29bf39cCopy full SHA for 29bf39c
src/Timer/Timers.php
@@ -18,15 +18,17 @@ final class Timers
18
private $timers = array();
19
private $schedule = array();
20
private $sorted = true;
21
+ private $useHighResolution;
22
- public function updateTime()
23
+ public function __construct()
24
{
25
// prefer high-resolution timer, available as of PHP 7.3+
- if (\function_exists('hrtime')) {
26
- return $this->time = \hrtime(true) * 1e-9;
27
- }
+ $this->useHighResolution = \function_exists('hrtime');
+ }
28
29
- return $this->time = \microtime(true) + 1000;
+ public function updateTime()
30
+ {
31
+ return $this->time = $this->useHighResolution ? \hrtime(true) * 1e-9 : \microtime(true);
32
}
33
34
public function getTime()
0 commit comments