note 61669 deleted from function.sleep by danbrown

From: Date: Sat, 14 Mar 2009 14:37:51 +0000
Subject: note 61669 deleted from function.sleep by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-151874@lists.php.net to get a copy of this message
Note Submitter: Josh ---- In regards to sleep being inconsistent, your benchmarks aren't accurate. You add overhead by bundling microtime() into your other function calls. I believe a more accurate benchmark could be obtained using this instead: <?php $t0 = microtime(); sleep(1); $t1 = microtime(); // Make your comparisons here ?> Granted I doubt that sleep() is accurate down to the nanosecond - the function call alone to retrieve the time will take time, and that amount of time may vary depending on the computer it is being run on, number of current processes and their priorities, etc. However, the above code will give you a more accurate representation. -- Josh

« previous php.notes (#151874) next »