unexplainable - page generation time class

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Howdy! I've made a class which simply determines the page generation time of a php script... After pretty much an hour of straight examining the code and trying tons of different things, no good has come of it, however I can't find an error... anywhere.

<?php
class page_gen {
//
// PRIVATE - DO NOT MODIFY
//
var $cls_start_time;
var $cls_stop_time;
var $cls_gen_time;
//
// FIGURE OUT THE TIME AT THE BEGINNING OF THE PAGE
//
function start() {
$microstart = explode(' ',microtime());
$this->cls_start_time = $microstart[0] + $microstart[1];
}
//
// FIGURE OUT THE TIME AT THE END OF THE PAGE
//
function stop() {
$microstop = explode(' ',microtime());
$this->cls_stop_time = $microstop[0] + $microstop[1];
}
//
// CALCULATE THE DIFFERENCE BETWEEN THE BEGINNNG AND THE END AND COLOR CODE THE RESULT
//
function gen() {
$this->cls_gen_time = $this->cls_stop_time - $this->cls_start_time;
return $this->cls_gen_time;
}
}
?>


What happens is it simply returns the $this->cls_start_time variable.

Both the start() and stop() functions work fine because to test them I put print commands at the end and they both returned proper results, the error appears to be in the line where I minus the start time from the end time. It simply returns a negative start time instead of minusing the two.

I tried changing the minus to a plus for testing sake and it just took out the negative. Does anybody have any idea what is going on here? Thanks-you

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux