<?php
/*
* Example to show how to time a section of code.
*
* Paul Gregg <pgregg@pgregg.com>
* 7 August 2003
* Qube @ Efnet #php
*
*/

Function StartTimer() {
  global $search_starttime;
  $search_starttime = microtime(true);
}

Function FinishTimer() {
  global $search_endtime;
  $search_endtime = microtime(true);
}


Function DifferenceTimer() {
  global $search_starttime;
  global $search_endtime;

/*
  list($smil, $ssec) = split(" ", $search_starttime);
  list($emil, $esec) = split(" ", $search_endtime);
  $emil = $emil * 1000000;
  $smil = $smil * 1000000;

  $runtime = ($esec*1000000 + $emil) - ($ssec*1000000 + $smil);
  $tot_secs = sprintf("%0d.%03d",  intval($runtime / 1000000), ($runtime % 1000000) );
*/
  $tot_secs = sprintf("%0.6f", $search_endtime-$search_starttime);
  #$runtime = $search_endtime-$search_starttime;
  return $tot_secs;
}

#print "Code took $tot_secs seconds.\n";

?>