ID:               29474
 Comment by:       no at back dot mail
 Reported By:      cucup at bol dot com dot br
 Status:           Closed
 Bug Type:         Unknown/Other Function
 Operating System: Windows 98
 PHP Version:      5.0.0
 New Comment:

if win32 cant evaluate microsecounds then win32 can of course round
these values

usleep(350499) woulde use win32 sleep procedures with values like
350.000 ...


Previous Comments:
------------------------------------------------------------------------

[2004-08-01 02:39:48] [EMAIL PROTECTED]

BTW: the u in usleep comes from "mu", the greek symbol used to denote
microseconds, not milliseconds. usleep(500) is much shorter than 1/2
second.

------------------------------------------------------------------------

[2004-08-01 02:36:33] [EMAIL PROTECTED]

Fixed this properly in CVS; the next batch of snapshots at
http://snaps.php.net will contain the fix.

FYI: Sleep() with fractional arguments is not real usleep(), take a
look at win32/time.c for a working implementation.

------------------------------------------------------------------------

[2004-07-31 22:40:43] cucup at bol dot com dot br

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.


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=29474&edit=1

Reply via email to