Fix net_usleep for durations greater than 1 second
This commit is contained in:
parent
9439f93ea4
commit
e423246e7f
@ -496,12 +496,12 @@ int net_set_nonblock( int fd )
|
|||||||
void net_usleep( unsigned long usec )
|
void net_usleep( unsigned long usec )
|
||||||
{
|
{
|
||||||
struct timeval tv;
|
struct timeval tv;
|
||||||
tv.tv_sec = 0;
|
tv.tv_sec = usec / 1000000;
|
||||||
#if !defined(_WIN32) && ( defined(__unix__) || defined(__unix) || \
|
#if !defined(_WIN32) && ( defined(__unix__) || defined(__unix) || \
|
||||||
( defined(__APPLE__) && defined(__MACH__) ) )
|
( defined(__APPLE__) && defined(__MACH__) ) )
|
||||||
tv.tv_usec = (suseconds_t) usec;
|
tv.tv_usec = (suseconds_t) usec % 1000000;
|
||||||
#else
|
#else
|
||||||
tv.tv_usec = usec;
|
tv.tv_usec = usec % 1000000;
|
||||||
#endif
|
#endif
|
||||||
select( 0, NULL, NULL, NULL, &tv );
|
select( 0, NULL, NULL, NULL, &tv );
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user