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

  1. /*
  2.  *    getticks -- get the current bios clock ticks value
  3.  */
  4.  
  5. #include <dos.h>
  6. #include <local\bioslib.h>
  7.  
  8. long
  9. getticks()
  10. {
  11.     long count;
  12.     union REGS inregs, outregs;
  13.  
  14.     /* get BIOS time of day as no. of ticks since midnight */
  15.     inregs.h.ah = 0;
  16.     int86(TOD, &inregs, &outregs);
  17.  
  18.     /* correct for possible rollover at 24 hours */
  19.     count = (outregs.h.al != 0) ? 0x01800B0L : 0;
  20.  
  21.     /* add current day ticks */
  22.     count += (outregs.x.dx + (outregs.x.cx << 16));
  23.  
  24.     return (count);
  25. }
  26.