Utilities related to time.
More...
|
#define | TIME_COMPARE(left, cmp, right) (((int32_t)((left) - (right))) cmp 0) |
|
Utilities related to time.
◆ TIME_COMPARE
#define TIME_COMPARE |
( |
|
left, |
|
|
|
cmp, |
|
|
|
right |
|
) |
| (((int32_t)((left) - (right))) cmp 0) |
A macro to compare two times, as returned from Thingstream_Platform_getTimeMillis(), and return TRUE if the given comparison holds. This macro handles zero-wrapping of either left or right values and provides a result assuming that the times are within 24 days of each other.
- Parameters
-
left | the left millisecond count |
cmp | the comparison |
right | the right millisecond count |
- Returns
- TRUE if (left cmp right) is true when treating left and right as reasonably close to each other.
◆ Thingstream_Util_run()
Repeatedly invoke a transport run() function until the given interval has passed. This is a simple way to sleep for a fixed period. As a convenience to the caller, the value Thingstream_Platform_getTimeMillis() is returned (and may be ignored).
- Parameters
-
transport | the transport instance |
delay | the delay in milliseconds |
- Returns
- transport current time
◆ Thingstream_Util_runUntil()
Repeatedly invoke a transport run() function until the given time limit is reached. As a convenience to the caller, the current time is returned, though it will usually be close to the 'when' parameter.
- Parameters
-
- Returns
- transport current time