note 44138 deleted from function.imap-headers by tomsommer
| From: | tomsommer@php.net | Date: | Thu, 15 Jul 2004 22:19:38 +0000 |
| Subject: | note 44138 deleted from function.imap-headers by tomsommer | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-73338@lists.php.net to get a copy of this message | ||
Note Submitter: ceo AT l-i-e DOT com
----
While I have little doubt that the function works as documented, the test code, as written, is
completely invalid.
You can't just subtract two restults from microtime.
Microtime returns a string with:
".microseconds seconds"
in it.
IE, it begins with a period (.) and then the microseconds, and then a space ( ) and then the
seconds.
You would need something more like:
$start_time = microtime();
;; code to be benchmarked here
$end_time = microtime();
list($start_usec, $start_sec) = explode(' ', $start_time);
list($end_usec, $end_sec) = explode(' ', $end_time);
$delta = ($end_sec + $end_usec) - ($start_sec + $start_usec);
echo "elapsed_time: $delta<BR>\n";
In the original source, the negative numbers indicate that the milliseconds portion of your ending
time is LOWER than the milliseconds portion of the starting time -- Which means that the seconds
portion has "turned over" to the next second -- or possibly several seconds later. It
could even be HOURS later, though I daresay you would have noticed that :-)