Skip to content

Commit 2929acc

Browse files
authored
Added support for retrieving the current system time with milliseconds for Hyperf\Support\Traits\InteractsWithTime (#6990)
1 parent 6a9d19f commit 2929acc

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

Diff for: src/Traits/InteractsWithTime.php

+16
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,23 @@ protected function parseDateInterval($delay)
6565
* Get the current system time as a UNIX timestamp.
6666
*/
6767
protected function currentTime(): int
68+
{
69+
return $this->currentTimestamp();
70+
}
71+
72+
/**
73+
* Get the current system time as a UNIX timestamp.
74+
*/
75+
protected function currentTimestamp(): int
6876
{
6977
return Carbon::now()->getTimestamp();
7078
}
79+
80+
/**
81+
* Get the current system time as a UNIX timestamp with milliseconds.
82+
*/
83+
protected function currentTimestampMs(): float
84+
{
85+
return Carbon::now()->getPreciseTimestamp(3);
86+
}
7187
}

0 commit comments

Comments
 (0)