microtime() Accuracy
| From: | Stephen J. Taranto | Date: | Wed, 05 Jul 2000 20:57:45 +0000 |
| Subject: | microtime() Accuracy | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-5066@lists.php.net to get a copy of this message | ||
I have a question about the accuracy of the microtime() function. Given the
following code ---
$st = split(" ", microtime());
// A bunch of PHP code.
$et = split(" ", microtime());
$ct = ($et[0] + $et[1]) - ($st[0] + $st[1]);
echo "<P>Clock: <B>$ct</B><BR>\n";
I'll regularly get $ct equal to .00172234121 and the like.
My question is just how accurate is that number? I really don't care about
anything past the thousandths place. Can I assume that it is at least
accurate to that point? I'd imagine this is highly dependent on the
OS/hardware. Anyone have a rule of thumb I can use for determining how
accurate this number is given a certain OS/hardware combinatio? I'm
primarily interesting in Solaris 7/Sparc, Linux/Intel and Win2k/Intel.
(BTW, PHP 4.0.0 no Zend optimization).
Thanks in advance!
-Steve.