C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\netspot\includes\domit\timer.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php

class Timer {
    var 
$startTime;
    var 
$stopTime;
    
    function 
start() {
        
$this->startTime microtime();
    } 
//start
    
    
function stop() {
        
$this->stopTime microtime();
    } 
//stop
    
    
function getTime() {
        return 
$this->elapsed($this->startTime$this->stopTime);
    } 
//getTime
    
    
function elapsed($a$b) {
        list(
$a_micro$a_int) = explode(' ',$a);
        list(
$b_micro$b_int) = explode(' ',$b);
        
        if (
$a_int $b_int) {
            return (
$a_int $b_int) + ($a_micro $b_micro);
        } 
        else if (
$a_int == $b_int) {
            if (
$a_micro $b_micro) {
                return (
$a_int $b_int) + ($a_micro $b_micro);
            } 
            else if (
$a_micro<$b_micro) {
                return (
$b_int $a_int) + ($b_micro $a_micro);
            } 
            else {
                return 
0;
             }
        } 
        else { 
// $a_int < $b_int
            
return ($b_int $a_int) + ($b_micro $a_micro);
        }
    } 
//elapsed
//Timer

?>