Location: PHPKode > projects > DarkCity > includes/Chrono.php
<?php
/**
 * Chrono.php : Calculateur de performance
 *
 * Date    : 31/05/2009
 * Auteur  : Philippe Bousquet
 * Version : 1.0
 * Contact : <hide@address.com>
 *
 * Copyright (c) 2008-2009 Philippe & Thierry Bousquet.
 *
 * Ce logiciel est distribué selon les termes de la GNU General Public License v2.
 */

class Chrono {

  var $timer = 0;
  
  function Chrono() {
  }
  
  function utime() {
    $time = explode( " ", microtime());
    $usec = (double)$time[0];
    $sec = (double)$time[1];
    return $sec + $usec;
  }
   
  function start() {
    $this->timer = $this->utime();
  }
  
  function stop() {
    $run = 0;
    if ($this->timer != 0) {
      $end = $this->utime();
      $run = $end - $this->timer;
      $this->timer = 0;
      $run = substr($run, 0, 5);
    }
    return $run;
  }
  
}

?>
Return current item: DarkCity