|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2004-08-01 02:36 UTC] wez@php.net
[2004-08-01 02:39 UTC] wez@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 27 12:00:02 2025 UTC |
Description: ------------ Function usleep doesn't work under Windows. I know this is documented, but I believe PHP5 could have this function working fine... Why not? Function "sleep" isn't enough for a lot of projects. There's a bug report in version 4.xx, in wich "dror at europe dot com" reported a solution for the source code.. It could be easily implemented in official PHP5 Source. PHP_FUNCTION(usleep) { pval **num; if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &num) == FAILURE) { WRONG_PARAM_COUNT; } convert_to_long_ex(num); #### Begin modifications from original source #if HAVE_USLEEP usleep((*num)->value.lval); #elif PHP_WIN32 Sleep( ((*num)->value.lval+999)/1000); #endif #### End modifications } Reproduce code: --------------- echo "Sleeping half second:"; usleep(500); // doesn't work under windows.. :( Expected result: ---------------- Stop script execution for 1/2 second, or 500ms Actual result: -------------- Nothing happens, line is ignored.