home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / snip9707.zip / UCLOCK.H < prev    next >
C/C++ Source or Header  |  1997-07-05  |  1KB  |  60 lines

  1. /* +++Date last modified: 05-Jul-1997 */
  2.  
  3. /*
  4. **  UCLOCK.H
  5. **
  6. **  Functions to perform microsecond accuracy timing operations
  7. **  and calculations.
  8. **
  9. **  Adapted from free sources originally by:
  10. **  Kris Heidenstrom (kheidens@actrix.gen.nz)
  11. **
  12. **  For additional information, ftp:
  13. **  oak.oakland.edu//SimTel/msdos/info/pctim*.zip.
  14. **
  15. **  Modified by Bob Stout.
  16. */
  17.  
  18. #ifndef UCLOCK__H
  19. #define UCLOCK__H
  20.  
  21. #include <dos.h>
  22. #include <time.h>
  23. #include "extkword.h"
  24.  
  25. /* Declarations and prototypes                                          */
  26.  
  27. typedef struct {                    /* Only 20, of 24, bits are used    */
  28.       unsigned short count;
  29.       unsigned long  ticks;
  30.       } Uclock_T;
  31.  
  32. typedef double  uclock_t;
  33.  
  34. /* Ticks per second - replaces CLK_TCK                                  */
  35. #define UCLK_TCK 1193181.667
  36.  
  37. /* uclock_t Midnight rollover value                                     */
  38. #define UCLK_RLVR (uclock_t)(0x001800af * 65536.0 + 0xffff)
  39.  
  40.  
  41. /* Functions in UCLOCK_.ASM                                             */
  42.  
  43. void CDECL Uclock_(Uclock_T *);
  44. void CDECL SetMode2_(void);
  45.  
  46. #if defined(__cplusplus) && __cplusplus
  47.  extern "C" {
  48. #endif
  49.  
  50. uclock_t    usec_clock(Uclock_T *now);
  51. uclock_t    uclock_diff(Uclock_T *Start, Uclock_T *Stop, Uclock_T *Diff);
  52. uclock_t    uclock_cnvrt(Uclock_T *ticks);
  53. void        usec_delay(unsigned long usecs);
  54.  
  55. #if defined(__cplusplus) && __cplusplus
  56.  }
  57. #endif
  58.  
  59. #endif /* UCLOCK__H */
  60.