13 static inline struct timespec
tic() {
14 struct timespec startTime;
15 clock_gettime(CLOCK_MONOTONIC, &startTime);
24 static inline double toc(
const struct timespec& startTime) {
25 struct timespec endTime;
26 clock_gettime(CLOCK_MONOTONIC, &endTime);
27 return (
static_cast<double>(endTime.tv_sec) -
static_cast<double>(startTime.tv_sec)) +
28 (
static_cast<double>(endTime.tv_nsec) -
static_cast<double>(startTime.tv_nsec)) /
38 struct timespec curTime;
39 clock_gettime(CLOCK_MONOTONIC, &curTime);
40 time_s = curTime.tv_sec + curTime.tv_nsec / 1e9;
58 static inline void get_time(uint64_t& time_ns) {
59 struct timespec curTime;
60 clock_gettime(CLOCK_MONOTONIC, &curTime);
61 time_ns =
static_cast<uint64_t
>(curTime.tv_sec) *
static_cast<int64_t
>(1000000000) +
82 static inline void get_time(int32_t& time_sec, int32_t& time_nsec) {
83 struct timespec curTime;
84 clock_gettime(CLOCK_MONOTONIC, &curTime);
85 time_sec =
static_cast<int32_t
>(curTime.tv_sec);
86 time_nsec =
static_cast<int32_t
>(curTime.tv_nsec);
static void get_time(uint64_t &time_ns)
static uint64_t get_time_ns()
static void get_time(double &time_s)
static void get_time(int32_t &time_sec, int32_t &time_nsec)
static double toc(const struct timespec &startTime)
static struct timespec tic()