Skip to content

Commit

Permalink
added other options
Browse files Browse the repository at this point in the history
  • Loading branch information
sarfraznawaz2005 committed Feb 26, 2012
1 parent f02f6fd commit 80ab8c4
Show file tree
Hide file tree
Showing 13 changed files with 6,574 additions and 11 deletions.
4 changes: 3 additions & 1 deletion TODO.txt
@@ -1,2 +1,4 @@
ajax loading while running code
snipt.net or similar integration
snipt.net or similar integration
unit testing framework implementation
php code coverage
2 changes: 1 addition & 1 deletion css/style.css
Expand Up @@ -86,7 +86,7 @@ h1 {
}

#code{
width:85%;
width:84%;
height:450px;
-moz-box-shadow: 0 5px 10px #AAAAAA;
-webkit-box-shadow: 0 5px 10px #AAAAAA;
Expand Down
48 changes: 48 additions & 0 deletions includes/classes/PE/timer.php
@@ -0,0 +1,48 @@
<?php

class timer
{
private $start_time = NULL;
private $end_time = NULL;

private function getmicrotime()
{
list($usec, $sec) = explode(" ", microtime());
return ((float)$usec + (float)$sec);
}

function start()
{
$this->start_time = $this->getmicrotime();
}

function stop()
{
$this->end_time = $this->getmicrotime();
}

function result()
{
if (is_null($this->start_time))
{
exit('Timer: start method not called !');
return false;
}
else if (is_null($this->end_time))
{
exit('Timer: stop method not called !');
return false;
}

return round(($this->end_time - $this->start_time), 4);
}

# an alias of result function
function time()
{
$this->result();
}

}

?>

0 comments on commit 80ab8c4

Please sign in to comment.