microtime
brefphp/bref
Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Return current Unix timestamp with microseconds
microtime
(
bool $as_float
=
false
):
string
|
float
private function
logStart
(
SymfonyStyle $io
,
string $requestId
):
float
{
$io
->
writeln
(
"START RequestId:
$requestId
Version: \$LATEST"
);
return
microtime
(
true
);
}
private function
logEnd
(
float $startTime
,
SymfonyStyle $io
,
string $requestId
):
void
src/Console/Command/Local.php
private function
logEnd
(
float $startTime
,
SymfonyStyle $io
,
string $requestId
):
void
{
$duration
=
ceil
((
microtime
(
true
) -
$startTime
) *
1000
);
$memoryUsed
=
ceil
(
memory_get_usage
() /
1024
/
1024
);
$io
->
writeln
([
src/Console/Command/Local.php
public function
getRemainingTimeInMillis
():
int
{
return
$this
->
deadlineMs
-
intval
(
microtime
(
true
) *
1000
);
}
src/Context/Context.php
'SERVER_PROTOCOL'
=>
$event
->
getProtocolVersion
(),
'REQUEST_METHOD'
=>
$event
->
getMethod
(),
'REQUEST_TIME'
=>
time
(),
'REQUEST_TIME_FLOAT'
=>
microtime
(
true
),
'QUERY_STRING'
=>
$event
->
getQueryString
(),
'DOCUMENT_ROOT'
=>
getcwd
(),
'REQUEST_URI'
=>
$event
->
getUri
(),
src/Event/Http/Psr7Bridge.php
self
::
assertNotEmpty
(
$response
[
'$_SERVER'
][
'HOME'
]);
unset(
$response
[
'$_SERVER'
][
'HOME'
]);
self
::
assertEqualsWithDelta
(
microtime
(
true
),
$response
[
'$_SERVER'
][
'REQUEST_TIME_FLOAT'
],
5
,
''
);
unset(
$response
[
'$_SERVER'
][
'REQUEST_TIME_FLOAT'
]);
self
::
assertEqualsWithDelta
(
time
(),
$response
[
'$_SERVER'
][
'REQUEST_TIME'
],
5
,
''
);
unset(
$response
[
'$_SERVER'
][
'REQUEST_TIME'
]);
tests/Handler/FpmHandlerTest.php