Removed 'base_path' from AkInstaller->setInstalledVersion because Ak:make_dir can...
[akelos.git] / vendor / domit / timer.php
blob9a5db37c6d7cf082cb135104ff5647b0ba34dd64
1 <?php
3 class Timer {
4 var $startTime;
5 var $stopTime;
7 function start() {
8 $this->startTime = microtime();
9 } //start
11 function stop() {
12 $this->stopTime = microtime();
13 } //stop
15 function getTime() {
16 return $this->elapsed($this->startTime, $this->stopTime);
17 } //getTime
19 function elapsed($a, $b) {
20 list($a_micro, $a_int) = explode(' ',$a);
21 list($b_micro, $b_int) = explode(' ',$b);
23 if ($a_int > $b_int) {
24 return ($a_int - $b_int) + ($a_micro - $b_micro);
26 else if ($a_int == $b_int) {
27 if ($a_micro > $b_micro) {
28 return ($a_int - $b_int) + ($a_micro - $b_micro);
30 else if ($a_micro<$b_micro) {
31 return ($b_int - $a_int) + ($b_micro - $a_micro);
33 else {
34 return 0;
37 else { // $a_int < $b_int
38 return ($b_int - $a_int) + ($b_micro - $a_micro);
40 } //elapsed
41 } //Timer