54 time_ns_to_s(time_duration_ns ns)
56 return (
float)(ns) / 1000000000.0f;
65 static inline time_duration_ns
66 time_s_to_ns(
float duration)
68 return (time_duration_ns)(duration * 1000000000.0f);
139 timepoint_ns timestamp,
140 struct timespec *out);
152 const struct timespec *timespecTime);
168 uint64_t monotonic_ns);
timepoint_ns time_state_get_now(struct time_state const *state)
Get the current time as an integer timestamp.
Definition: u_time.cpp:83
timepoint_ns time_state_get_now_and_update(struct time_state *state)
Get the current time as an integer timestamp and update internal state.
Definition: u_time.cpp:92
int64_t time_duration_ns
Integer duration type in nanoseconds.
Definition: u_time.h:45
int64_t timepoint_ns
Integer timestamp type.
Definition: u_time.h:34
void time_state_to_timespec(struct time_state const *state, timepoint_ns timestamp, struct timespec *out)
Convert an integer timestamp to a struct timespec (system time).
Definition: u_time.cpp:107
void time_state_destroy(struct time_state **state)
Destroy a struct time_state.
Definition: u_time.cpp:70
Time-keeping state structure.
Definition: u_time.cpp:46
timepoint_ns time_state_from_monotonic_ns(struct time_state const *state, uint64_t monotonic_ns)
Convert a monotonic system time (such as from Portable Timekeeping) to an adjusted integer timestamp...
Definition: u_time.cpp:157
struct time_state * time_state_create()
Create a struct time_state.
Definition: u_time.cpp:62
timepoint_ns time_state_from_timespec(struct time_state const *state, const struct timespec *timespecTime)
Convert a struct timespec (system time) to an integer timestamp.
Definition: u_time.cpp:132