Microtime

A

Anonymous

Guest
The correct way to get the time is:
Code:
list($microseconds,$seconds) = explode(" ",microtime());
$time = $seconds.substr($microseconds,1);
Do this at the start of the page, and at the end to get two different values, take one away from the other to get the page generation time.

To determine how long the user spent on the last page, you have to find out the time the next page is called, and minus from it the time when the original page was generated. It's pretty complicated and leaves you very open for errors!!
 
Back
Top