libcoap
4.1.2
|
Default implementation of internal clock. More...
Macros | |
#define | COAP_TICKS_PER_SECOND 1000 |
Use ms resolution on POSIX systems. More... | |
Typedefs | |
typedef unsigned long | coap_tick_t |
This data type represents internal timer ticks with COAP_TICKS_PER_SECOND resolution. More... | |
typedef time_t | coap_time_t |
CoAP time in seconds since epoch. More... | |
typedef long | coap_tick_diff_t |
This data type is used to represent the difference between two clock_tick_t values. More... | |
Functions | |
void | coap_clock_init (void) |
Initializes the internal clock. More... | |
void | coap_ticks (coap_tick_t *t) |
Sets t to the internal time with COAP_TICKS_PER_SECOND resolution. More... | |
coap_time_t | coap_ticks_to_rt (coap_tick_t t) |
Helper function that converts coap ticks to wallclock time. More... | |
static 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. More... | |
static 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. More... | |
Default implementation of internal clock.
#define COAP_TICKS_PER_SECOND 1000 |
Use ms resolution on POSIX systems.
Definition at line 99 of file coap_time.h.
typedef long 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 96 of file coap_time.h.
typedef unsigned long coap_tick_t |
This data type represents internal timer ticks with COAP_TICKS_PER_SECOND resolution.
Definition at line 84 of file coap_time.h.
typedef time_t coap_time_t |
CoAP time in seconds since epoch.
Definition at line 89 of file coap_time.h.
void coap_clock_init | ( | void | ) |
Initializes the internal clock.
Definition at line 27 of file coap_time.c.
void coap_ticks | ( | coap_tick_t * | t | ) |
Sets t
to the internal time with COAP_TICKS_PER_SECOND resolution.
Definition at line 49 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 82 of file coap_time.c.
|
inlinestatic |
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 136 of file coap_time.h.
|
inlinestatic |
Returns 1
if and only if a
is less than b
where less is defined on a signed data type.
Definition at line 128 of file coap_time.h.