/* sleeps for t miliseconds. Compiled successfully on:
1) AIX (needs: #include which others do not need)
2) Convex Exemplar
3) DecAlpha OSF
4) Linux (ELF RedHat 2.0)
5) SGI/IRIX
6) SunOS 4.0
7) SunOS 5.0
*/
#include
#include
#include
#include
#include
#include
/* the include below is only needed for AIX . Uncomment it if needed */
/* #include */
struct timeval delay;
void ms_sleep(t)
int t;
{
int s;
long us;
if(t <= 0) {
return;
}
s = t/1000;
us = (t % 1000) * 1000;
if(s > 0) {
sleep(s);
}
if(us > 0) {
delay.tv_sec = 0;
delay.tv_usec = us;
select(0, (fd_set *)0, (fd_set *)0, (fd_set *)0, &delay);
}
return;
}
|