mirror of
https://gitee.com/hyperf/hyperf.git
synced 2024-11-29 18:27:44 +08:00
Added support for retrieving the current system time with milliseconds for Hyperf\Support\Traits\InteractsWithTime
(#6990)
This commit is contained in:
parent
8d04672d88
commit
531c173e47
@ -2,6 +2,7 @@
|
||||
|
||||
## Added
|
||||
|
||||
- [#6990](https://github.com/hyperf/hyperf/pull/6990) Added support for retrieving the current system time with milliseconds for `Hyperf\Support\Traits\InteractsWithTime`.
|
||||
- [#6998](https://github.com/hyperf/hyperf/pull/6998) Added default methods for `#[AutoController]`. (You can add method `options` which used to support cors middleware)
|
||||
|
||||
# v3.1.35 - 2024-08-08
|
||||
|
@ -65,7 +65,23 @@ trait InteractsWithTime
|
||||
* Get the current system time as a UNIX timestamp.
|
||||
*/
|
||||
protected function currentTime(): int
|
||||
{
|
||||
return $this->currentTimestamp();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current system time as a UNIX timestamp.
|
||||
*/
|
||||
protected function currentTimestamp(): int
|
||||
{
|
||||
return Carbon::now()->getTimestamp();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current system time as a UNIX timestamp with milliseconds.
|
||||
*/
|
||||
protected function currentTimestampMs(): float
|
||||
{
|
||||
return Carbon::now()->getPreciseTimestamp(3);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user