|
|
1.1.1.2 ! root 1: /************* ! 2: * sleep.c -- provide unix style sleep function ! 3: * ! 4: *************/ ! 5: #include <time.h> ! 6: ! 7: int sleep(unsigned secs){ ! 8: long start; ! 9: long check; ! 10: long finish; ! 11: ! 12: time(&start); ! 13: finish = start + (long) secs; ! 14: #ifdef DEBUG ! 15: printf ("sleep for %d secs, stop sleeping at %ld\n", secs, finish); ! 16: time(&check); ! 17: printf ("it is now %ld\n", check ); ! 18: #endif ! 19: for (;;) { ! 20: time(&check); ! 21: if (check > finish) ! 22: break; ! 23: } ! 24: return (0); ! 25: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.