add epg_event_find_current_or_upcoming() - find current or upcoming event on a channel

This commit is contained in:
Andreas Öman 2007-11-04 09:35:21 +00:00
parent 217cb2b318
commit 900c7f6fff
2 changed files with 14 additions and 0 deletions

12
epg.c
View file

@ -109,6 +109,18 @@ epg_event_get_current(th_channel_t *ch)
return e;
}
event_t *
epg_event_find_current_or_upcoming(th_channel_t *ch)
{
event_t *e;
TAILQ_FOREACH(e, &ch->ch_epg_events, e_link)
if(e->e_start + e->e_duration > dispatch_clock)
break;
return e;
}
static int
startcmp(event_t *a, event_t *b)
{

2
epg.h
View file

@ -50,4 +50,6 @@ void epg_transfer_events(th_channel_t *ch, struct event_queue *src,
void event_time_txt(time_t start, int duration, char *out, int outlen);
event_t *epg_event_find_current_or_upcoming(th_channel_t *ch);
#endif /* EPG_H */