_nap.c 266 B

1234567891011121314151617181920
  1. #include "lib.h"
  2. #include <unistd.h>
  3. #include <time.h>
  4. #include "sys9.h"
  5. /*
  6. * This is an extension to POSIX
  7. */
  8. unsigned int
  9. _nap(unsigned int millisecs)
  10. {
  11. time_t t0, t1;
  12. t0 = time(0);
  13. if(_SLEEP(millisecs) < 0){
  14. t1 = time(0);
  15. return t1-t0;
  16. }
  17. return 0;
  18. }