[prev in list] [next in list] [prev in thread] [next in thread]
List: php-doc-bugs
Subject: [DOC-BUGS] #50039 [Opn]: example code at time_sleep_until-function is IMHO wrong
From: "ingo at baab dot de" <doc-bugs () lists ! php ! net>
Date: 2009-10-30 11:21:52
Message-ID: 200910301121.n9UBLq0K030282 () y1 ! php ! net
[Download RAW message or body]
ID: 50039
User updated by: ingo at baab dot de
Reported By: ingo at baab dot de
Status: Open
Bug Type: Documentation problem
Operating System: All
PHP Version: Irrelevant
New Comment:
correction: use microtime(true); instead
Previous Comments:
------------------------------------------------------------------------
[2009-10-30 11:18:40] ingo at baab dot de
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 this bug report at http://bugs.php.net/?id=50039&edit=1
--
PHP Documentation Bugs Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic