9 #ifndef INCLUDE_FUNAPI_TIME_MONOTONIC_CLOCK_H_
10 #define INCLUDE_FUNAPI_TIME_MONOTONIC_CLOCK_H_
29 ret->tv_sec = value / (1000 * 1000);
30 ret->tv_nsec = value % (1000 * 1000) * 1000;
35 return sec * 1000 * 1000;
53 clock_gettime(CLOCK_MONOTONIC, &now);
54 return now.tv_sec * 1000 * 1000 + now.tv_nsec / 1000;
63 #endif // INCLUDE_FUNAPI_TIME_MONOTONIC_CLOCK_H_
static Duration FromSec(int64_t sec)
Converts sec value into Duration.
Definition: monotonic_clock.h:34
static Duration FromMsec(int64_t msec)
Converts msec value into Duration.
Definition: monotonic_clock.h:39
static Duration FromUsec(int64_t usec)
Converts usec value into Duration.
Definition: monotonic_clock.h:44
static void ToTimespec(const Value &value, struct timespec *ret)
Converts the given Monotonic clock value into timespec.
Definition: monotonic_clock.h:28
Funapi uses MonotonicClock to be overcome clock drift.
Definition: monotonic_clock.h:19
int64_t Duration
duration value in usec.
Definition: monotonic_clock.h:25
static Value Now()
Returns the current Monotonic value.
Definition: monotonic_clock.h:51
int64_t Value
clock value in usec.
Definition: monotonic_clock.h:22