/* As above, but return -1 for no deadline, and do not cap to 2^32 as we know the result is always positive.  */
int64_t timerlist_deadline_ns(QEMUTimerList *timer_list)
/* As above, but return -1 for no deadline, and do not cap to 2^32 as we know the result is always positive.  */
int64_t timerlist_deadline_ns(QEMUTimerList *timer_list)
{
    int64_t delta;
    int64_t expire_time;
    if (!timer_list->clock->enabled) {
        return -1;
    }
    qemu_mutex_lock(&timer_list->active_timers_lock);
    if (!timer_list->active_timers) {
        qemu_mutex_unlock(&timer_list->active_timers_lock);
        return -1;
    }
    expire_time = timer_list->active_timers->expire_time;
    qemu_mutex_unlock(&timer_list->active_timers_lock);
    delta = expire_time - qemu_clock_get_ns(timer_list->clock->type);
    if (delta <= 0) {
        return 0;
    }
    return delta;
}