mirror of
https://github.com/jimeh/dlist.git
synced 2026-02-19 07:56:41 +00:00
- made simple template almost feature complete by implementing view modes and more
- other general fixes to things a bit all over the place git-svn-id: file:///Users/jimeh/Desktop/dlist/trunk@12 a5845835-ea0f-0410-a762-dd0bfe9bfde8
This commit is contained in:
@@ -4,12 +4,13 @@ class speedometer {
|
||||
|
||||
/*
|
||||
|
||||
Class: Speedometer v0.1.1
|
||||
Class: Speedometer v0.2
|
||||
Created to simplify script execution statistics...
|
||||
|
||||
*/
|
||||
|
||||
var $digits = 6;
|
||||
var $pattern = '%s'; // must contain %s
|
||||
|
||||
var $start;
|
||||
var $time;
|
||||
@@ -19,7 +20,17 @@ class speedometer {
|
||||
$this->start = $this->getmicrotime();
|
||||
}
|
||||
|
||||
function end ($digits=false) {
|
||||
// return with pattern
|
||||
function end ($digits=false, $pattern=false) {
|
||||
$end = $this->getmicrotime();
|
||||
$digits = ( preg_match("/[0-9]{1,2}/", $digits) ) ? $digits : $this->digits ;
|
||||
$pattern = ( stristr($pattern, '%s') != false ) ? $pattern : $this->pattern ;
|
||||
$this->time = number_format( ($end - $this->start), $digits);
|
||||
return str_replace('%s', $this->time, $pattern);
|
||||
}
|
||||
|
||||
// return time only ignoring pattern
|
||||
function term ($digits=false) {
|
||||
$end = $this->getmicrotime();
|
||||
$digits = ( preg_match("/[0-9]{1,2}/", $digits) ) ? $digits : $this->digits ;
|
||||
return $this->time = number_format( ($end - $this->start), $digits);
|
||||
|
||||
Reference in New Issue
Block a user