Darn missed it. Looking into the docs I am using code
somthing like this:
$start = microtime();
$result = mysql_query ( $query, $mysql );
$end = microtime();
$diff = microtime_diff ($start, $end);
function microtimdiff() is given by:
function microtime_diff($a, $b)
{
list($a_dec, $a_sec) = explode(" ", $a);
list($b_dec, $b_sec) = explode(" ", $b);
return ((float)$b_sec - (float)$a_sec +
(float)$b_dec - (float)$a_dec);
}
The result from one operation is like:
$start = 0.26562800 1093931165
$end = 0.26813400 1093931165
$diff = 0.002506
So to get the difference in ms I have to multilply
$diff by 1000.
Am I correct?
Regards,
Karam
--- John Holmes <[EMAIL PROTECTED]> wrote:
> Karam Chand wrote:
> > In Win32 API to profile a job we use the following
> > method:
> >
> >
> > timetaken = GetTickCount();
> > /* do some job */
> > timetaken = GetTickCount() - timetaken;
> >
> > In this way timetaken returns you the time taken
> by
> > the job to complete?
> >
> > How can I get it in PHP. I want the exact figure
> in
> > ms? I used microtime() and the samples given in
> > php.net but none of them correctly returns the
> > difference only in ms?
>
> Read the manual page again. Use the example to get
> the microtime as a
> float at the start and then after your job. Subtract
> to get the
> difference. If you're using PHP5, just use
> microtime(TRUE); to get the
> float value.
>
> --
>
> ---John Holmes...
>
> Amazon Wishlist:
> www.amazon.com/o/registry/3BEXC84AB3A5E/
>
> php|architect: The Magazine for PHP Professionals �
> www.phparch.com
>
>
>
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php