timer_read

Definition

timer_read($name)
includes/bootstrap.inc, line 206

Description

Read the current timer value without stopping the timer.

Parameters

name The name of the timer.

Return value

The current timer value in ms.

Code

<?php
function timer_read($name) {
  global $timers;

  if (isset($timers[$name]['start'])) {
    list($usec, $sec) = explode(' ', microtime());
    $stop = (float)$usec + (float)$sec;
    $diff = round(($stop - $timers[$name]['start']) * 1000, 2);

    if (isset($timers[$name]['time'])) {
      $diff += $timers[$name]['time'];
    }
    return $diff;
  }
}
?>
 
 

Drupal is a registered trademark of Dries Buytaert.