mirror of
https://github.com/DanielnetoDotCom/YouPHPTube
synced 2025-10-04 10:19:24 +02:00
29 lines
No EOL
762 B
PHP
29 lines
No EOL
762 B
PHP
<?php
|
|
|
|
namespace Safe;
|
|
|
|
use Safe\Exceptions\MiscException;
|
|
|
|
/**
|
|
*
|
|
* @param int $seconds Halt time in seconds.
|
|
* @return int Returns zero on success.
|
|
*
|
|
* If the call was interrupted by a signal, sleep returns
|
|
* a non-zero value. On Windows, this value will always be
|
|
* 192 (the value of the
|
|
* WAIT_IO_COMPLETION constant within the Windows API).
|
|
* On other platforms, the return value will be the number of seconds left to
|
|
* sleep.
|
|
* @throws MiscException
|
|
* @deprecated The Safe version of this function is no longer needed in PHP 8.0+
|
|
*/
|
|
function sleep(int $seconds): int
|
|
{
|
|
error_clear_last();
|
|
$safeResult = \sleep($seconds);
|
|
if ($safeResult === false) {
|
|
throw MiscException::createFromPhpError();
|
|
}
|
|
return $safeResult;
|
|
} |