25 #define XRT_HAVE_TIMESPEC 26 #define XRT_HAVE_TIMEVAL 28 #elif defined(XRT_DOXYGEN) 30 #define XRT_HAVE_TIMESPEC 31 #define XRT_HAVE_TIMEVAL 34 #error "No time support on non-Linux platforms yet." 63 os_nanosleep(
long nsec)
68 spec.tv_nsec = nsec, nanosleep(&spec, NULL);
72 #ifdef XRT_HAVE_TIMESPEC 77 static inline uint64_t
78 os_timespec_to_ns(
struct timespec *spec)
81 ns += (uint64_t)spec->tv_sec * 1000 * 1000 * 1000;
82 ns += (uint64_t)spec->tv_nsec;
85 #endif // XRT_HAVE_TIMESPEC 88 #ifdef XRT_HAVE_TIMEVAL 93 static inline uint64_t
94 os_timeval_to_ns(
struct timeval *val)
97 ns += (uint64_t)val->tv_sec * 1000 * 1000 * 1000;
98 ns += (uint64_t)val->tv_usec * 1000;
101 #endif // XRT_HAVE_TIMEVAL 108 static inline uint64_t
109 os_monotonic_get_ns(
void)
113 int ret = clock_gettime(CLOCK_MONOTONIC, &ts);
118 return os_timespec_to_ns(&ts);
Auto detect OS and certain features.
Header holding common defines.