}
/* }}} */
-/* {{{ proto void sleep(int seconds)
+/* {{{ proto int sleep(int seconds)
Delay for a given number of seconds */
PHP_FUNCTION(sleep)
{
zend_value_error("Number of seconds must be greater than or equal to 0");
return;
}
-#ifdef PHP_SLEEP_NON_VOID
- RETURN_LONG(php_sleep((unsigned int)num));
-#else
- php_sleep((unsigned int)num);
-#endif
+ RETURN_LONG(php_sleep((unsigned int)num));
}
/* }}} */
$time_start = microtime(true);
// Sleep for a while
-sleep($sleeptime);
+$result = sleep($sleeptime);
// Test passes if sleeps for at least 98% of specified time
$sleeplow = $sleeptime - ($sleeptime * 2 /100);
$time = $time_end - $time_start;
echo "Thread slept for " . $time . " seconds\n";
+echo "Return value: " . $result . "\n";
if ($time >= $sleeplow) {
echo "TEST PASSED\n";
--EXPECTF--
*** Testing sleep() : basic functionality ***
Thread slept for %f seconds
+Return value: 0
TEST PASSED
===DONE===
/* global variables */
#if !defined(PHP_WIN32)
-#define PHP_SLEEP_NON_VOID
#define php_sleep sleep
extern char **environ;
#endif /* !defined(PHP_WIN32) */
/* its in win32/time.c */
#define HAVE_USLEEP 1
#define HAVE_NANOSLEEP 1
-#define PHP_SLEEP_NON_VOID 1
#define HAVE_GETCWD 1
#define NEED_ISBLANK 1