home *** CD-ROM | disk | FTP | other *** search
/ Microsoft Programmer's Library 1.3 / Microsoft-Programers-Library-v1.3.iso / sampcode / prof_c / 05oslib / bios / delay.c < prev    next >
Encoding:
C/C++ Source or Header  |  1988-08-11  |  483 b   |  24 lines

  1. /* 
  2.  *    delay -- provide a delay of ** approximately ** the
  3.  *    specified duration (resolution is about 0.055 second)
  4.  */
  5.  
  6. #include <local\timer.h>
  7.  
  8. void
  9. delay(d)
  10. float d;    /* duration in seconds and fractional seconds */
  11. {
  12.     long ticks, then;
  13.     extern long getticks();
  14.  
  15.     /* convert duration to number of PC clock ticks */
  16.     ticks = d * TICKRATE;
  17.  
  18.     /* delay for the specified interval */
  19.     then = getticks() + ticks;
  20.     while (1)
  21.         if (getticks() >= then)
  22.             break;
  23. }
  24.