1 2 3 4 5 6 7 8 9 10 11
#include <unistd.h> #include <time.h> unsigned int sleep(unsigned int secs) { struct timespec t; t.tv_sec=secs; t.tv_nsec=0; nanosleep(&t,&t); return secs-t.tv_sec; }