wayvnc/include/time-util.h

17 lines
378 B
C
Raw Normal View History

2019-12-29 10:06:25 +00:00
#include <time.h>
#include <stdint.h>
static inline uint64_t gettime_us(void)
2019-12-29 10:06:25 +00:00
{
struct timespec ts = { 0 };
clock_gettime(CLOCK_MONOTONIC, &ts);
return ts.tv_sec * 1000000ULL + (double)ts.tv_nsec / 1000ULL;
2019-12-29 10:06:25 +00:00
}
static inline uint32_t gettime_ms(void)
{
struct timespec ts = { 0 };
clock_gettime(CLOCK_MONOTONIC, &ts);
return ts.tv_sec * 1000UL + ts.tv_nsec / 1000000UL;
}