Re: Possible RFC: $_SERVER['REQUEST_TIME_FLOAT']
| From: | Rowan Tommins | Date: | Wed, 12 Apr 2023 11:53:42 +0000 |
| Subject: | Re: Possible RFC: $_SERVER['REQUEST_TIME_FLOAT'] | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-119952@lists.php.net to get a copy of this message | ||
On Wed, 12 Apr 2023 at 11:01, Herbert Groot Jebbink <
herbert@groot.jebbink.nl> wrote:
>
> I'm in the process of using hrtime(true) instead of microtime(true), for
> this it would be great if REQUEST_TIME_HR would also exist next to
> REQUEST_TIME and REQUEST_TIME_FLOAT
Hi :)
The idea sounds reasonable on the face of it.
Are there any performance issues calling hrtime on every request (possibly
platform-specific)?
I note that the existing values are not fetched directly from a time
source, but have some logic for SAPIs to provide a value [1] e.g. from the
Apache request context [2], and then REQUEST_TIME is just
REQUEST_TIME_FLOAT truncated to integer.
Should the same approach happen here? e.g. should all three values be based
on hrtime if the SAPI does not provide a value? Would we even need an extra
value if REQUEST_TIME_FLOAT had enough precision?
[1] https://heap.space/xref/php-src/main/SAPI.c?r=9d5f2f13#1085
[2]
https://heap.space/xref/php-src/sapi/apache2handler/sapi_apache2.c?r=4da0da7f#371
Regards,
--
Rowan Tommins
[IMSoP]