note 109928 added to function.microtime
| From: | final at skilled dot ch | Date: | Mon, 03 Sep 2012 16:20:50 +0000 |
| Subject: | note 109928 added to function.microtime | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-190460@lists.php.net to get a copy of this message | ||
Note that php's microtime() and time() function might not necessarily return the same time. I
don't know why this is the case (I assume microtime() and time() use different kernel
functions). This is reproduceable under both linux and windows (I only tested intel and ARM CPUs
though):
for linux, use this:
<?php
for ($i = 0; $i < 1000000; $i++)
{
if (time() < floor(microtime(true))) {
echo ".";
}
}
?>
if microtime and time would switch to the next second at exactly the same time, you should never see
any . out of this script. However, it does produces some . under both linux and windows.
----
Server IP: 62.2.182.223
Probable Submitter: 80.219.216.93
----
Manual Page -- http://www.php.net/manual/en/function.microtime.php
Edit -- https://master.php.net/note/edit/109928
Del: integrated -- https://master.php.net/note/delete/109928/integrated
Del: useless -- https://master.php.net/note/delete/109928/useless
Del: bad code -- https://master.php.net/note/delete/109928/bad+code
Del: spam -- https://master.php.net/note/delete/109928/spam
Del: non-english -- https://master.php.net/note/delete/109928/non-english
Del: in docs -- https://master.php.net/note/delete/109928/in+docs
Del: other reasons-- https://master.php.net/note/delete/109928
Reject -- https://master.php.net/note/reject/109928
Search -- https://master.php.net/manage/user-notes.php