-
-
Notifications
You must be signed in to change notification settings - Fork 158
Expand file tree
/
Copy pathClock.php
More file actions
43 lines (34 loc) · 893 Bytes
/
Clock.php
File metadata and controls
43 lines (34 loc) · 893 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php
declare(strict_types=1);
namespace Tempest\Clock;
use Psr\Clock\ClockInterface;
use Tempest\DateTime\DateTimeInterface;
use Tempest\DateTime\Duration;
use Tempest\DateTime\Timestamp;
interface Clock
{
/**
* Returns the current date and time.
*/
public function now(): DateTimeInterface;
/**
* Returns the same instance as a PSR-7 Clock Interface.
*/
public function toPsrClock(): ClockInterface;
/**
* Returns the current timestamp.
*/
public function timestamp(): Timestamp;
/**
* Returns the current UNIX timestamp in seconds.
*/
public function seconds(): int;
/**
* Returns the current timestamp in milliseconds.
*/
public function milliseconds(): int;
/**
* Sleeps for the given number of milliseconds.
*/
public function sleep(int|Duration $milliseconds): void;
}