At 10:57 PM 10/22/2004 +0200, dharana wrote:
Ilia Alshanetsky wrote:

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).

I would think the reason for fetching request start time is to profile execution time (the first line you would see in my scripts is always $time_start = microtime()) or maybe it's just me, of course.

I think using current time for timestamps in DBs and so on can be very useful. I think Ilia had in mind wider use and not specifically for profiling where the performance of the initial call to time() wouldn't have any significance.


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.

I'm for $_SERVER, it makes most sense for me.

$_SERVER[] is fine. The downside that it's an extra hash_update() on each requests even if you don't use the time (as opposed to an internal function). But in real life this would not be noticeable.


Andi

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to