/* If there are not scheduled events this function returns 0; otherwise it returns 1 and *next_event_time is set to the start time of the next event. */
int ble_ll_sched_next_time(uint32_t *next_event_time)
/* If there are not scheduled events this function returns 0; otherwise it returns 1 and *next_event_time is set to the start time of the next event. */
int ble_ll_sched_next_time(uint32_t *next_event_time)
{
    int rc;
    os_sr_t sr;
    struct ble_ll_sched_item *first;
    rc = 0;
    OS_ENTER_CRITICAL(sr);
    first = TAILQ_FIRST(&g_ble_ll_sched_q);
    if (first) {
        *next_event_time = first->start_time;
        rc = 1;
    }
    OS_EXIT_CRITICAL(sr);
    return rc;
}