Commit cec41faf authored by Dries's avatar Dries
Browse files

- Patch #723436 by mikeryan: timers accumulated at double-speed in certain scenarios.

parent 0f712430
......@@ -296,13 +296,17 @@ function timer_read($name) {
function timer_stop($name) {
global $timers;
if (isset($timers[$name]['time'])) {
$timers[$name]['time'] += timer_read($name);
}
else {
$timers[$name]['time'] = timer_read($name);
if (isset($timers[$name]['start'])) {
$stop = microtime(TRUE);
$diff = round(($stop - $timers[$name]['start']) * 1000, 2);
if (isset($timers[$name]['time'])) {
$timers[$name]['time'] += $diff;
}
else {
$timers[$name]['time'] = $diff;
}
unset($timers[$name]['start']);
}
unset($timers[$name]['start']);
return $timers[$name];
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment