io/m_event_timer.c
/*! Returns time in ms for the minimum timer trigger value, or M_TIMEOUT_INF if there
 *  are no timers.  A lock on M_event_t should already be held before calling this. */
Returns time in ms for the minimum timer trigger value, or M_TIMEOUT_INF if there
are no timers.  A lock on M_event_t should already be held before calling this.
Returns time in ms for the minimum timer trigger value or M_TIMEOUT_INF if there are no timers . A lock on M_event_t should already be held before calling this .
M_uint64 M_event_timer_minimum_ms(M_event_t *event)
{
	M_event_timer_t   *timer;
	M_int64            time_ms;
	M_timeval_t        curr;
	timer = M_queue_first(event->u.loop.timers);
	if (timer == NULL) {
		return M_TIMEOUT_INF;
	}
	if (!timer->started) {
		return M_TIMEOUT_INF;
	}
	M_time_elapsed_start(&curr);
	time_ms = M_time_timeval_diff(&curr, &timer->next_run);
	if (time_ms < 0)
		time_ms = 0;
	return (M_uint64)time_ms;
}
M_uint64 M_event_timer_minimum_ms ( M_event_t * event ) { M_event_timer_t * timer ; M_int64 time_ms ; M_timeval_t curr ; timer = M_queue_first ( event -> u . loop . timers ) ; if ( timer == NULL ) { return M_TIMEOUT_INF ; } if ( ! timer -> started ) { return M_TIMEOUT_INF ; } M_time_elapsed_start ( & curr ) ; time_ms = M_time_timeval_diff ( & curr , & timer -> next_run ) ; if ( time_ms < 0 ) time_ms = 0 ; return ( M_uint64 ) time_ms ; }
Returns time in ms for the minimum timer trigger value, or M_TIMEOUT_INF if there
  are no timers.
Returns time in ms for the minimum timer trigger value or M_TIMEOUT_INF if there are no timers .
/* Elapsed_start just pulls the current counter */