Function anjay_sched_calculate_wait_time_ms

Function Documentation

int anjay_sched_calculate_wait_time_ms(anjay_t *anjay, int limit_ms)

Calculates time in milliseconds the client code may wait for incoming events before the need to call anjay_sched_run .

This function combines anjay_sched_time_to_next_ms with a user-provided limit, so that a conclusive value will always be returned. It is provided as a convenience for users of system calls such as poll().

Parameters:
  • anjay – Anjay object to operate on.

  • limit_ms – The longest amount of time the function shall return.

Returns:

Relative time from now of next scheduled task, in milliseconds, if such task exists and it’s scheduled to run earlier than limit_ms seconds from now, or limit_ms otherwise.