PHP 5.1 time() caching
| From: | Ilia Alshanetsky | Date: | Fri, 22 Oct 2004 20:43:15 +0000 |
| Subject: | PHP 5.1 time() caching | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-13472@lists.php.net to get a copy of this message | ||
As of PHP 5.1, the request start time is stored by PHP inside the sapi structure. This data is populated by the information offered by the SAPI (Apache sapis populate it) otherwise time(0) is used to get the same data.
This means that PHP has a "free" unix timestamp that tells information about the request start time, which does not require a syscall.
. Since a lot of script end up having to fetch request start time, this can be used to save on a timing call
(This information only has second precision, no microseconds).
The question is what would be the best way to provide this information within the script. The two alternatives are: adding a new function to get this info or storing this data inside $_SERVER.
What do you think?
Ilia