#50039 [NEW]: example code at time_sleep_until-function is IMHO wrong

From: Date: Fri, 30 Oct 2009 11:18:40 +0000
Subject: #50039 [NEW]: example code at time_sleep_until-function is IMHO wrong
Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-3022@lists.php.net to get a copy of this message
From: ingo at baab dot de Operating system: All PHP version: Irrelevant PHP Bug Type: Documentation problem Bug description: example code at time_sleep_until-function is IMHO wrong Description: ------------ The example in the documentation is IMHO wrong. time_sleep_until() wants a timestamp as float, but the example shows getting a value from time(). Here should be used microtime(true) to get a float value. The shown example will only work accidentally right (without a warning), if (time()+0.2) is not allready in the past when generated. Use microtime() instead here. Reproduce code: --------------- --- From manual page: function.time-sleep-until#Beispiele --- <?php // Gibt false zurück und generiert eine Warnung var_dump(time_sleep_until(time()-1)); // funktioniert evtl. nur auf schnellen Rechnern, schläft für bis zu 0.2 Sekunden var_dump(time_sleep_until(time()+0.2)); ?> -- Edit bug report at http://bugs.php.net/?id=50039&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=50039&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=50039&r=trysnapshot53 Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=50039&r=trysnapshot60 Fixed in SVN: http://bugs.php.net/fix.php?id=50039&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=50039&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=50039&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=50039&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=50039&r=needscript Try newer version: http://bugs.php.net/fix.php?id=50039&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=50039&r=support Expected behavior: http://bugs.php.net/fix.php?id=50039&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=50039&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=50039&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=50039&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=50039&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=50039&r=dst IIS Stability: http://bugs.php.net/fix.php?id=50039&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=50039&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=50039&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=50039&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=50039&r=mysqlcfg

« previous php.doc.bugs (#3022) next »