Debian Codegraph @

vendor/ramsey/uuid/src/Provider/Time/SystemTimeProvider.php

raw
1 <?php
2
3 /**
4 * This file is part of the ramsey/uuid library
5 *
6 * For the full copyright and license information, please view the LICENSE
7 * file that was distributed with this source code.
8 *
9 * @copyright Copyright (c) Ben Ramsey <[email protected]>
10 * @license http://opensource.org/licenses/MIT MIT
11 */
12
13 declare(strict_types=1);
14
15 namespace Ramsey\Uuid\Provider\Time;
16
17 use Ramsey\Uuid\Provider\TimeProviderInterface;
18 use Ramsey\Uuid\Type\Time;
19
20 use function gettimeofday;
21
22 /**
23 * SystemTimeProvider retrieves the current time using built-in PHP functions
24 */
25 class SystemTimeProvider implements TimeProviderInterface
26 {
27 public function getTime(): Time
28 {
29 $time = gettimeofday();
30
31 return new Time($time['sec'], $time['usec']);
32 }
33 }