14#if FML_TIMERFD_AVAILABLE == 0
16#include <asm/unistd.h>
17#include <sys/syscall.h>
20 return syscall(__NR_timerfd_create, clockid, flags);
25 const struct itimerspec* utmr,
26 struct itimerspec* otmr) {
27 return syscall(__NR_timerfd_settime, ufc, flags, utmr, otmr);
35#define NSEC_PER_SEC 1000000000
47 struct itimerspec spec = {};
48 spec.it_value.tv_sec =
static_cast<time_t
>(nano_secs /
NSEC_PER_SEC);
50 spec.it_interval = spec.it_value;
54 FML_DLOG(ERROR) <<
"timerfd_settime err:" << strerror(errno);
61 uint64_t fire_count = 0;
63 if (size !=
sizeof(uint64_t)) {
66 return fire_count > 0;
constexpr int64_t ToNanoseconds() const
constexpr TimeDelta ToEpochDelta() const
#define FML_HANDLE_EINTR(x)
#define FML_DLOG(severity)
bool TimerRearm(int fd, fml::TimePoint time_point)
Rearms the timer to expire at the given time point.
int timerfd_settime(int ufc, int flags, const struct itimerspec *utmr, struct itimerspec *otmr)
int timerfd_create(int clockid, int flags)
#define TFD_TIMER_ABSTIME