/* sleeps for t miliseconds. This in not a clean routine and gives
some compile time warning due to incompatible variable types in
parameter list. However, it works on:
1) Cray/Unicos
2) Convex Exemplar
3) Linux
4) SGI/IRIX
5) SunOS 4
6) SunOS 5
*/
#include
#include
#include
#include
#include
static struct {
long tv_sec;
long tv_usec;
} 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, (long *)0, (long *)0, (long *)0, &delay);
}
return;
}
|