Re: Microtime math and display

From: Date: Thu, 08 Mar 2001 14:07:18 +0000
Subject: Re: Microtime math and display
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-43028@lists.php.net to get a copy of this message
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. Thomas INN Database Programmer | | Phone: (309) 743-0812 Fax : (309) 743-0830 | | Email: sthomas@townnews.com AIM : trifthen | | Web : hamster.lee.net | | | | "Most of our lives are about proving something, either to | | "ourselves or to someone else." | | -- Anonymous | +-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-+

« previous php.general (#43028) next »