1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Polyfill\Php73;
13
14/**
15 * @author Gabriel Caruso <carusogabriel34@gmail.com>
16 * @author Ion Bazan <ion.bazan@gmail.com>
17 *
18 * @internal
19 */
20final class Php73
21{
22    public static $startAt = 1533462603;
23
24    /**
25     * @param bool $asNum
26     *
27     * @return array|float|int
28     */
29    public static function hrtime($asNum = false)
30    {
31        $ns = microtime(false);
32        $s = substr($ns, 11) - self::$startAt;
33        $ns = 1E9 * (float) $ns;
34
35        if ($asNum) {
36            $ns += $s * 1E9;
37
38            return \PHP_INT_SIZE === 4 ? $ns : (int) $ns;
39        }
40
41        return [$s, (int) $ns];
42    }
43}
44