timeout_next(struct timeval *tv)
timeout_next(struct event_base *base, struct timeval *tv)
timeout_next(struct timeval *tv){	struct timeval dflt = TIMEOUT_DEFAULT;	struct timeval now;	struct event *ev;	if ((ev = RB_MIN(event_tree, &timetree)) == NULL) {		*tv = dflt;		return (0);	}	if (gettimeofday(&now, NULL) == -1)		return (-1);	if (timercmp(&ev->ev_timeout, &now, <=)) {		timerclear(tv);		return (0);	}	timersub(&ev->ev_timeout, &now, tv);	assert(tv->tv_sec >= 0);	assert(tv->tv_usec >= 0);	LOG_DBG((LOG_MISC, 60, "timeout_next: in %d seconds", tv->tv_sec));	return (0);}