PHP sleep accuracy
- by Abs
Hello all,
I use the following code to see how long a user is on a particular page. I use a hidden image with a src attribute to this script:
$timer_seconds = 1;
while(!connection_aborted()) {
echo "\n";
flush();
sleep(1);
$timer_seconds++;
}
I sometimes find this can be off by 5-10 seconds! I am guessing its the load of the server that effects the timing??
Is there anyway I can make this accurate?
Thanks all for any help.