25#if defined(XRT_ENV_MINGW)
29#define byte win_byte_override
39#define U_1_000_000_000 (1000 * 1000 * 1000)
47#define U_TIME_1S_IN_NS U_1_000_000_000
54#define U_TIME_1MS_IN_NS (1000 * 1000)
61#define U_TIME_HALF_MS_IN_NS (U_TIME_1MS_IN_NS / 2)
142 return (-range < t) && (t < range);
312#if defined(XRT_OS_WINDOWS) || defined(XRT_DOXYGEN)
static bool time_is_greater_then_or_within_range(timepoint_ns a, timepoint_ns b, int64_t range)
Fuzzy comparisons.
Definition: u_time.h:188
static bool time_is_less_then_or_within_half_ms(timepoint_ns a, timepoint_ns b)
Fuzzy comparisons.
Definition: u_time.h:176
int64_t timepoint_ns
Integer timestamp type.
Definition: u_time.h:70
static double time_ns_to_ms_f(time_duration_ns ns)
Convert nanoseconds to double float milliseconds, useful for printing.
Definition: u_time.h:114
static bool time_is_less_then_or_within_range(timepoint_ns a, timepoint_ns b, int64_t range)
Fuzzy comparisons.
Definition: u_time.h:164
timepoint_ns time_state_get_now(struct time_state const *state)
Get the current time as an integer timestamp.
Definition: u_time.cpp:66
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:94
timepoint_ns time_state_from_win32perfcounter(struct time_state const *state, const LARGE_INTEGER *qpc_ticks)
Converts from Win32 "QPC" ticks to timestamp.
struct time_state * time_state_create(int64_t offset)
Create a struct time_state.
Definition: u_time.cpp:42
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:74
static double time_ns_to_s(time_duration_ns ns)
Convert nanoseconds duration to double seconds.
Definition: u_time.h:90
static bool time_is_within_half_ms(timepoint_ns a, timepoint_ns b)
Checks if two timepoints are with half a millisecond of each other.
Definition: u_time.h:152
int64_t time_state_ts_to_monotonic_ns(struct time_state const *state, timepoint_ns timestamp)
Convert a adjusted integer timestamp to an monotonic system time (such as from Portable Timekeeping).
Definition: u_time.cpp:115
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:82
static bool time_is_within_range_of_each_other(timepoint_ns a, timepoint_ns b, int64_t range)
Checks if two timepoints are with a certain range of each other.
Definition: u_time.h:139
void time_state_to_win32perfcounter(struct time_state const *state, timepoint_ns timestamp, LARGE_INTEGER *out_qpc_ticks)
Converts a timestamp to Win32 "QPC" ticks.
static timepoint_ns time_ms_f_to_ns(double ms_f)
Convert double float milliseconds to nanoseconds, human comprehensible config inputs.
Definition: u_time.h:127
static bool time_is_greater_then_or_within_half_ms(timepoint_ns a, timepoint_ns b)
Fuzzy comparisons.
Definition: u_time.h:200
int64_t time_duration_ns
Integer duration type in nanoseconds.
Definition: u_time.h:81
timepoint_ns time_state_monotonic_to_ts_ns(struct time_state const *state, int64_t monotonic_ns)
Convert a monotonic system time (such as from Portable Timekeeping) to an adjusted integer timestamp.
Definition: u_time.cpp:107
static time_duration_ns time_s_to_ns(double duration)
Convert float seconds to nanoseconds.
Definition: u_time.h:102
void time_state_destroy(struct time_state **state)
Destroy a struct time_state.
Definition: u_time.cpp:53
Time-keeping state structure.
Definition: u_time.cpp:30
#define U_TIME_HALF_MS_IN_NS
The number of nanoseconds in half a millisecond.
Definition: u_time.h:61
#define U_TIME_1S_IN_NS
The number of nanoseconds in a second.
Definition: u_time.h:47
#define U_TIME_1MS_IN_NS
The number of nanoseconds in a millisecond.
Definition: u_time.h:54
Header holding common defines.