Philip Hallstrom wrote:
$diff = number_format(((substr($timeend,0,9)) +
(substr($timeend,-10)) - (substr($timestart,0,9)) -
(substr($timestart,-10))),4);
This just looks wrong to me... at the very least shouldn't it be:
(x + x) - (x + x)
(x + y) - (w + z) = (x + y) + (-w - z) = x + y - w - z
Which is what I have. If you look closely, I don't have (x + x) - (x -
x), which yes, would be wrong.
You've currently got the last + as a -.
Also, why not split the result of microtime on a space in case $usec
is more than 9 digits....?
$usec is microseconds. I'm not really concerned about more than
ten-thousandths of a second, so I don't even really need 9 digits.
Conversly, I only need the seconds digits that are changing, and I can
guarantee (hopefully) that my script is not taking so long that I need
more than 10 digits to calculate the difference in seconds.
It may be ridiculously convoluted code, I'll grant you that ;) - I took
it from old script somewhere and didn't think of the looking in the
manual for the much simpler example - but I'm pretty sure the math is fine.
Anyways, I can assure you that it is too fast for me to count 1, 2, 3
CLI, but I get up to 20-something waiting for it to run under apache.
Any ideas?
kgt
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php