1 #ifndef SCARAB_TIME_HH_ 2 #define SCARAB_TIME_HH_ 17 #include <mach/mach_time.h> 26 #define NSEC_PER_SEC 1000000000 30 #define SEC_PER_NSEC 1.e-9 35 #define MACNANO (+1.0E-9) 36 #define MACGIGA UINT64_C(1000000000) 38 extern double thorax_timebase;
53 inline SCARAB_API bool operator==(
const timespec& lhs,
const timespec& rhs ) {
return lhs.tv_nsec==rhs.tv_nsec && lhs.tv_sec==rhs.tv_sec; }
54 inline SCARAB_API bool operator<(
const timespec& lhs,
const timespec& rhs ) {
return lhs.tv_sec != rhs.tv_sec ? lhs.tv_sec < rhs.tv_sec : lhs.tv_nsec < rhs.tv_nsec; }
61 SCARAB_API int clock_gettime(
int X,
struct timespec* tv );
74 SCARAB_API void time_diff(
struct timespec start,
struct timespec end,
struct timespec* diff );
82 #endif // SCARAB_TIME_HH_
std::string get_absolute_time_string()
size_t get_time_absolute_str(char *ptr)
void time_diff(struct timespec start, struct timespec end, struct timespec *diff)
int get_time_current(struct timespec *time)
bool operator<(const timespec &lhs, const timespec &rhs)
time_nsec_type time_to_nsec(struct timespec time)
double time_to_sec(struct timespec time)
int get_time_monotonic(struct timespec *time)
bool operator==(const timespec &lhs, const timespec &rhs)