time moving backwards?
Posted by: jtnye
Posted on: 2006-02-16 06:42:00
for($i=0;$i<10000;$i++) {
$start = microtime(true);
for($k=0;$k<1000;$k++) { } // Do some work
$delta = microtime(true) - $start;
if($delta < 0) {
print "Negative delta: $delta
";
}
}
When running this PHP5 code about 99% of the time $delta is a positive as it should be. But some times I get a negative $delta! How can this be? It's usually around -1.8 seconds.
Can anyone explain why this is happening?
--josh