#include <stdlib.h>
/******************************************************/
/* small nanosleep example */
/* This baby can lower the load on systems if you use */
/* it with shit like this: */
/* user@host:~$ watch -n0 w\;nsleep 100 */
/* */
/* howto compile: in the same dir as nsleep.c type */
/* user@host:~$ make nsleep;strip nsleep */
/* or: */
/* user@host:~$ cc -o nsleep nsleep.c ;strip nsleep */
/******************************************************/
int main (int argc, char* argv[]){
long long int i;
if (argc < 2){
printf("Usage: %s num, waits num 1000ths of a second\n",argv[0]);
return 1;
}else{
i=atoll(argv[1]);
i*=1000;
usleep(i);
}
return 0;
}
download this