home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / games / volume8 / cutup / part01 / usleep.c < prev   
C/C++ Source or Header  |  1989-09-18  |  545b  |  46 lines

  1. #include <curses.h>
  2. #include "consts.h"
  3. #include "types.h"
  4. #include "funcs.h"
  5.  
  6. #ifdef M_XENIX
  7. void MillisecondSleep(ms)
  8.  
  9. int ms;
  10.  
  11.     {
  12.     (void)nap(ms);
  13.     }
  14. #else
  15. #ifdef SYS5_3
  16.  
  17. #include <sys/poll.h>
  18.  
  19. void MillisecondSleep(ms)
  20.  
  21. int ms;
  22.  
  23.     {
  24.     (void) poll((struct pollfd *)0, 0L, ms);
  25.  
  26.     return (1);
  27.     }
  28. #else
  29.  
  30. /* this must be the last resort, single user machines only! */
  31.  
  32. MAKE SURE YOU CHECK THIS WHILE YOU ARE PORTING
  33.  
  34. int MillisecondSleep(ms)
  35.  
  36. int ms;
  37.  
  38.     {
  39.     int start = clock();
  40.     int end = ms * 1000;
  41.  
  42.     while (clock() - start < end);
  43.     }
  44. #endif
  45. #endif
  46.