php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #9340 usleep function doesn't work properly under winNT 4.0
Submitted: 2001-02-19 13:16 UTC Modified: 2001-02-24 14:18 UTC
From: dror at europe dot com Assigned:
Status: Closed Package: Date/time related
PHP Version: 4.0.4pl1 OS: winNT 4.0
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: dror at europe dot com
New email:
PHP Version: OS:

 

 [2001-02-19 13:16 UTC] dror at europe dot com
here is the wrong code (current) + my correction:

---- > Wrong (current) <----

PHP_FUNCTION(usleep)
{
#if HAVE_USLEEP
	pval **num;

	if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &num) == FAILURE) {
		WRONG_PARAM_COUNT;
	}
	convert_to_long_ex(num);
	usleep((*num)->value.lval);
#endif
}

---- > Correction <----
	
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);
#if HAVE_USLEEP
	usleep((*num)->value.lval);
#elif PHP_WIN32
   Sleep( ((*num)->value.lval+999)/1000);
#endif
}

Dror.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-02-22 19:26 UTC] sniper@php.net
Please try the latest dev build from http://www.php4win.de/ 
(under downloads) as this should be fixed already in CVS. IIRC

--Jani

 [2001-02-24 14:18 UTC] jmoore@php.net
Fixed in CVS
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Dec 27 00:01:30 2024 UTC