hiclock.h 724 B

123456789101112131415161718192021222324252627282930313233
  1. #ifndef __hiclock_h__
  2. #define __hiclock_h__
  3. #include <stdint.h>
  4. #include <inttypes.h>
  5. #if defined(__unix__)
  6. #include <sys/time.h>
  7. #define PRIuHICLOCK PRIu64
  8. #define PRIiHICLOCK PRIi64
  9. typedef uint64_t hiclock_t;
  10. #define HICLOCKS_PER_SEC 1000000
  11. #define hiclock_init()
  12. #elif defined(__WIN32) || defined(__WIN64)
  13. #include <windows.h>
  14. #define PRIuHICLOCK PRIu64
  15. #define PRIiHICLOCK PRIi64
  16. typedef LONGLONG hiclock_t;
  17. extern LONGLONG HICLOCKS_PER_SEC;
  18. extern void hiclock_init();
  19. #else
  20. #include <time.h>
  21. #define PRIuHICLOCK PRIu32
  22. #define PRIiHICLOCK PRIi32
  23. typedef clock_t hiclock_t;
  24. #define HICLOCKS_PER_SEC CLOCKS_PER_SEC
  25. #define hiclock_init()
  26. #endif
  27. extern hiclock_t hiclock();
  28. #endif