nano-client API Reference
|
Data Structures | |
struct | NANO_Time |
A type to represent time-stamps and time durations. More... | |
Macros | |
#define | NANO_TIME_INITIALIZER { 0, 0 } |
A macro that can be used to initialize static values of NANO_Time. | |
#define | NANO_TIME_INITIALIZER_INFINITE { -1, 0 } |
TODO. | |
#define | NANO_TIMEOUT_INFINITE (-1) |
TODO. | |
Typedefs | |
typedef NANO_i32 | NANO_Timeout |
TODO. | |
Functions | |
NANO_RetCode | NANO_Time_initialize (NANO_Time *const self, const NANO_i32 sec, const NANO_u32 nanosec) |
Initialize a NANO_Time and make sure it is normalized. More... | |
NANO_bool | NANO_Time_is_infinite (const NANO_Time *const self) |
Check if a NANO_Time instance is infinite. More... | |
NANO_bool | NANO_Time_is_zero (const NANO_Time *const self) |
Check if a NANO_Time instance is zero. More... | |
NANO_RetCode | NANO_Time_normalize (const NANO_Time *const self, NANO_Time *const norm_t_out) |
Generate a normalized version of a NANO_Time instance. More... | |
void | NANO_Time_to_millis (const NANO_Time *const self, NANO_u64 *const millis_out) |
Convert a NANO_Time instance to a milliseconds representation. More... | |
NANO_RetCode | NANO_Time_to_sec (const NANO_Time *const self, NANO_u32 *const sec_out) |
Convert a NANO_Time instance to a seconds representation. More... | |
NANO_RetCode NANO_Time_initialize | ( | NANO_Time *const | self, |
const NANO_i32 | sec, | ||
const NANO_u32 | nanosec | ||
) |
Initialize a NANO_Time and make sure it is normalized.
self | the instance to initialize. |
sec | the "seconds" component of the new instance. |
nanosec | the "nanoseconds" component of the new instance. |
Check if a NANO_Time instance is infinite.
self | the instance to check. |
Check if a NANO_Time instance is zero.
self | the instance to check. |
NANO_RetCode NANO_Time_normalize | ( | const NANO_Time *const | self, |
NANO_Time *const | norm_t_out | ||
) |
Generate a normalized version of a NANO_Time instance.
The source and destination instances must not be the same.
self | The instance to normalize. |
norm_t_out | A normalized representation of the input instance. |
Convert a NANO_Time instance to a milliseconds representation.
The returned value will be rounded up if the instance has a "nanoseconds" component.
The instance must contain a "finite" time.
self | The instance to convert. |
millis_out | The instance's time in seconds (rounded up) |
NANO_RetCode NANO_Time_to_sec | ( | const NANO_Time *const | self, |
NANO_u32 *const | sec_out | ||
) |
Convert a NANO_Time instance to a seconds representation.
The returned value will be rounded up if the instance has a "nanoseconds" component.
The instance must contain a "finite" time.
self | The instance to convert. |
sec_out | The instance's time in seconds (rounded up) |