note 129205 added to function.sleep
| From: | John at main dot php dot net | Date: | Tue, 30 Jan 2024 15:09:52 +0000 |
| Subject: | note 129205 added to function.sleep | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-221159@lists.php.net to get a copy of this message | ||
To avoid using usleep function that is not working on every operating system, below a function that
should have the same behavior :
function wait(int $millisecond = 0) {
if (0 !== $millisecond) {
$seconds = (int) ($millisecond / 1000);
$nanoSeconds = ($millisecond % 1000) * 1000000;
time_nanosleep($seconds, $nanoSeconds);
}
}
----
Server IP: 45.112.84.4
Probable Submitter: 45.91.157.134 (proxied: 147.161.232.97)
----
Manual Page -- https://php.net/manual/en/function.sleep.php
Edit -- https://main.php.net/note/edit/129205
Del: integrated -- https://main.php.net/note/delete/129205/integrated
Del: useless -- https://main.php.net/note/delete/129205/useless
Del: bad code -- https://main.php.net/note/delete/129205/bad+code
Del: spam -- https://main.php.net/note/delete/129205/spam
Del: non-english -- https://main.php.net/note/delete/129205/non-english
Del: in docs -- https://main.php.net/note/delete/129205/in+docs
Del: other reasons-- https://main.php.net/note/delete/129205
Reject -- https://main.php.net/note/reject/129205
Search -- https://main.php.net/manage/user-notes.php