libcoap 4.3.5-develop-490e4e0
|
API for internal clock assess. More...
Macros | |
#define | COAP_TICKS_PER_SECOND ((coap_tick_t)(1000U)) |
Use ms resolution on POSIX systems. | |
#define | COAP_MAX_DELAY_TICKS (24 * 60 * 60 * COAP_TICKS_PER_SECOND) |
Typedefs | |
typedef uint64_t | coap_tick_t |
This data type represents internal timer ticks with COAP_TICKS_PER_SECOND resolution. | |
typedef time_t | coap_time_t |
CoAP time in seconds since epoch. | |
typedef int64_t | coap_tick_diff_t |
This data type is used to represent the difference between two clock_tick_t values. | |
Functions | |
void | coap_clock_init (void) |
Initializes the internal clock. | |
void | coap_ticks (coap_tick_t *t) |
Sets t to the internal time with COAP_TICKS_PER_SECOND resolution. | |
coap_time_t | coap_ticks_to_rt (coap_tick_t t) |
Helper function that converts coap ticks to wallclock time. | |
uint64_t | coap_ticks_to_rt_us (coap_tick_t t) |
Helper function that converts coap ticks to POSIX wallclock time in us. | |
coap_tick_t | coap_ticks_from_rt_us (uint64_t t) |
Helper function that converts POSIX wallclock time in us to coap ticks. | |
COAP_STATIC_INLINE int | coap_time_lt (coap_tick_t a, coap_tick_t b) |
Returns 1 if and only if a is less than b where less is defined on a signed data type. | |
COAP_STATIC_INLINE int | coap_time_le (coap_tick_t a, coap_tick_t b) |
Returns 1 if and only if a is less than or equal b where less is defined on a signed data type. | |
API for internal clock assess.
#define COAP_MAX_DELAY_TICKS (24 * 60 * 60 * COAP_TICKS_PER_SECOND) |
Definition at line 230 of file coap_time.h.
#define COAP_TICKS_PER_SECOND ((coap_tick_t)(1000U)) |
Use ms resolution on POSIX systems.
Definition at line 166 of file coap_time.h.
typedef int64_t coap_tick_diff_t |
This data type is used to represent the difference between two clock_tick_t values.
This data type must have the same size in memory as coap_tick_t to allow wrapping.
Definition at line 163 of file coap_time.h.
typedef uint64_t coap_tick_t |
This data type represents internal timer ticks with COAP_TICKS_PER_SECOND resolution.
Definition at line 151 of file coap_time.h.
typedef time_t coap_time_t |
CoAP time in seconds since epoch.
Definition at line 156 of file coap_time.h.
void coap_clock_init | ( | void | ) |
Initializes the internal clock.
Definition at line 68 of file coap_time.c.
void coap_ticks | ( | coap_tick_t * | t | ) |
Sets t
to the internal time with COAP_TICKS_PER_SECOND resolution.
Sets t
to the internal time with COAP_TICKS_PER_SECOND resolution.
The counter counts COAP_TICKS_PER_SECOND
ticks every second.
Definition at line 90 of file coap_time.c.
coap_tick_t coap_ticks_from_rt_us | ( | uint64_t | t | ) |
Helper function that converts POSIX wallclock time in us to coap ticks.
t | POSIX time is us |
Definition at line 133 of file coap_time.c.
coap_time_t coap_ticks_to_rt | ( | coap_tick_t | t | ) |
Helper function that converts coap ticks to wallclock time.
On POSIX, this function returns the number of seconds since the epoch. On other systems, it may be the calculated number of seconds since last reboot or so.
t | Internal system ticks. |
Definition at line 123 of file coap_time.c.
uint64_t coap_ticks_to_rt_us | ( | coap_tick_t | t | ) |
Helper function that converts coap ticks to POSIX wallclock time in us.
t | Internal system ticks. |
Definition at line 128 of file coap_time.c.
COAP_STATIC_INLINE int coap_time_le | ( | coap_tick_t | a, |
coap_tick_t | b | ||
) |
Returns 1
if and only if a
is less than or equal b
where less is defined on a signed data type.
Definition at line 225 of file coap_time.h.
COAP_STATIC_INLINE int coap_time_lt | ( | coap_tick_t | a, |
coap_tick_t | b | ||
) |
Returns 1
if and only if a
is less than b
where less is defined on a signed data type.
Definition at line 216 of file coap_time.h.