diff options
author | Dries Buytaert <dries@buytaert.net> | 2010-02-25 09:13:00 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2010-02-25 09:13:00 +0000 |
commit | cec41faf474c0a7df4cbe3da38e62ae08d713ead (patch) | |
tree | 6665a3e4aceeae27933b80820a8cdc77510a5f95 | |
parent | 0f712430a6747668f22f8d617590e8057c28180b (diff) | |
download | brdo-cec41faf474c0a7df4cbe3da38e62ae08d713ead.tar.gz brdo-cec41faf474c0a7df4cbe3da38e62ae08d713ead.tar.bz2 |
- Patch #723436 by mikeryan: timers accumulated at double-speed in certain scenarios.
-rw-r--r-- | includes/bootstrap.inc | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/includes/bootstrap.inc b/includes/bootstrap.inc index 05a654bf1..9a1691fb1 100644 --- a/includes/bootstrap.inc +++ b/includes/bootstrap.inc @@ -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]; } |