From 900c7f6fff856248d1441393cdd0ce5a53ecfe0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20=C3=96man?= Date: Sun, 4 Nov 2007 09:35:21 +0000 Subject: [PATCH] add epg_event_find_current_or_upcoming() - find current or upcoming event on a channel --- epg.c | 12 ++++++++++++ epg.h | 2 ++ 2 files changed, 14 insertions(+) diff --git a/epg.c b/epg.c index 5c8320dc..c682e180 100644 --- a/epg.c +++ b/epg.c @@ -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) { diff --git a/epg.h b/epg.h index 4a9414bf..a1802059 100644 --- a/epg.h +++ b/epg.h @@ -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 */