summaryrefslogtreecommitdiff
path: root/includes/bootstrap.inc
diff options
context:
space:
mode:
Diffstat (limited to 'includes/bootstrap.inc')
-rw-r--r--includes/bootstrap.inc16
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];
}