Re: [PHP] Microtime math and display
On Wed, 7 Mar 2001, Todd Cary wrote: I want to check the time for queries. I have $starttime = getmicrotime(); $endtime = getmicrotime(); $delta = $endtime - $starttime; There is no such function as "getmicrotime". You're probably trying to use "microtime". Second of all, microtime returns a string containing "msec sec", so you'll need to do this: list($smsec, $ssec) = explode(" ", microtime()); list($emsec, $esec) = explode(" ", microtime()); $dSec = $esec - $ssec $dMsec = $emsec - $smsec Then, if you wanted the number of seconds it took, use $dSec. If you want the number of milliseconds, use $dMsec. Or, if you want to know both, just add $dSec and $dMsec and use the result. Take care -- +-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-+ | Shaun M. ThomasINN Database Programmer | | Phone: (309) 743-0812 Fax : (309) 743-0830| | Email: [EMAIL PROTECTED]AIM : trifthen | | Web : hamster.lee.net | | | | "Most of our lives are about proving something, either to | | "ourselves or to someone else." | | -- Anonymous | +-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-+ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Microtime math and display
I want to check the time for queries. I have $starttime = getmicrotime(); $endtime = getmicrotime(); $delta = $endtime - $starttime; How do I display the seconds/milliseconds? Many thanks.. Todd -- Todd Cary Ariste Software [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Microtime math and display
?php function mtime() { $mtime = microtime(); $mtime = str_replace('.', '', $mtime); $mtime = explode(' ', $mtime); $mtime = $mtime[1] . $mtime[0]; return($mtime); } class debug { function debug() { $this-start = mtime(); } function reset() { $all_vars = get_object_vars($this); foreach($all_vars as $pos = $val) if ($pos != 'error') unset($this-$pos); } function time($text = '') { $this-break = mtime(); $time = ($this-break - $this-start) / 10; echo number_format($time, 4) .' '. $text ."br\n"; $this-start = $this-break; } } $debug = new debug; //--- $debug-time('start'); // code snippit $debug-time('end'); ? -- Chris Lee Mediawaveonline.com ph. 250.377.1095 ph. 250.376.2690 fx. 250.554.1120 [EMAIL PROTECTED] "Todd Cary" [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... I want to check the time for queries. I have $starttime = getmicrotime(); $endtime = getmicrotime(); $delta = $endtime - $starttime; How do I display the seconds/milliseconds? Many thanks.. Todd -- Todd Cary Ariste Software [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]