php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #36410 usleep() do strange behavior
Submitted: 2006-02-16 08:56 UTC Modified: 2006-02-16 11:18 UTC
From: sqchen at citiz dot net Assigned:
Status: Closed Package: Unknown/Other Function
PHP Version: 5.1.2 OS: redhat 7.3
Private report: No CVE-ID: None
 [2006-02-16 08:56 UTC] sqchen at citiz dot net
Description:
------------
there are two questions:
first:      usleep(214748000009);
            usleep(214749000009);

second:      usleep(-1);
             usleep(-214748000009);


Actual result:
--------------
first:   usleep(214748000009) wait for a long time (I am   not sure hong long?)
         usleep(214749000009) wait for 1 second


second:  usleep(-1)  wait for a long time
         usleep(-214748000009) wait for 0 second
         

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-02-16 11:18 UTC] tony2001@php.net
While I agree, this function should not allow using negative values (fixed in CVS), float values are ok, as long as they are autoconverted to a valid integer.
That's where the problem comes from: float -> int convertion may end up with negative integer value, even though float value was positive. 
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 11:01:30 2024 UTC