39 time_t t = time(NULL);
41 struct tm *now = localtime_r(&t, &tm_r);
44 start = now->tm_hour * 100 + now->tm_min;
50 if (
const cEvent *
Event = Schedule->GetPresentEvent()) {
62 struct tm *time = localtime_r(&tstart, &tm_r);
63 start = time->tm_hour * 100 + time->tm_min;
64 time = localtime_r(&tstop, &tm_r);
65 stop = time->tm_hour * 100 + time->tm_min;
97 time_t tstop = tstart + Event->
Duration();
103 struct tm *time = localtime_r(&tstart, &tm_r);
106 start = time->tm_hour * 100 + time->tm_min;
107 time = localtime_r(&tstop, &tm_r);
108 stop = time->tm_hour * 100 + time->tm_min;
113 const char *Title = Event->
Title();
135 if (&Timer !=
this) {
154 aux = Timer.
aux ? strdup(Timer.
aux) : NULL;
174 cString buffer =
cString::sprintf(
"%u:%s:%s:%04d:%04d:%d:%d:%s:%s\n",
flags, UseChannelID ? *
Channel()->GetChannelID().ToString() : *
itoa(
Channel()->Number()), *
PrintDay(
day,
weekdays,
true),
start,
stop,
priority,
lifetime,
file,
aux ?
aux :
"");
186 return (t / 100 * 60 + t % 100) * 60;
203 const char *a = strchr(s,
'@');
204 const char *d = a ? a + 1 : isdigit(*s) ? s : NULL;
206 if (strlen(d) == 10) {
208 if (3 == sscanf(d,
"%d-%d-%d", &tm_r.tm_year, &tm_r.tm_mon, &tm_r.tm_mday)) {
209 tm_r.tm_year -= 1900;
211 tm_r.tm_hour = tm_r.tm_min = tm_r.tm_sec = 0;
221 int day = strtol(d, &tail, 10);
222 if (tail && *tail || day < 1 || day > 31)
224 time_t t = time(NULL);
225 int DaysToCheck = 61;
226 for (
int i = -1; i <= DaysToCheck; i++) {
235 if (a || !isdigit(*s)) {
236 if ((a && a - s == 7) || strlen(s) == 7) {
237 for (
const char *p = s + 6; p >= s; p--) {
239 WeekDays |= (*p !=
'-');
250 #define DAYBUFFERSIZE 64
255 const char *w =
trNOOP(
"MTWTFSS");
256 if (!SingleByteChars)
261 for (
int i = 0; i < sl; i++)
275 localtime_r(&Day, &tm_r);
276 b += strftime(b,
DAYBUFFERSIZE - (b - buffer),
"%Y-%m-%d", &tm_r);
294 char *channelbuffer = NULL;
295 char *daybuffer = NULL;
296 char *filebuffer = NULL;
307 while (l2 > 0 && isspace(s[l2 - 1]))
309 if (s[l2 - 1] ==
':') {
310 s2 =
MALLOC(
char, l2 + 3);
311 strcat(
strn0cpy(s2, s, l2 + 1),
" \n");
315 if (8 <= sscanf(s,
"%u :%a[^:]:%a[^:]:%d :%d :%d :%d :%a[^:\n]:%a[^\n]", &
flags, &channelbuffer, &daybuffer, &
start, &
stop, &
priority, &
lifetime, &filebuffer, &
aux)) {
330 esyslog(
"ERROR: channel %s not defined", channelbuffer);
343 return fprintf(f,
"%s", *
ToText(
true)) > 0;
354 return localtime_r(&t, &tm_r)->tm_mday;
360 int weekday = localtime_r(&t, &tm_r)->tm_wday;
361 return weekday == 0 ? 6 : weekday - 1;
372 tm tm = *localtime_r(&t, &tm_r);
384 tm tm = *localtime_r(&t, &tm_r);
385 tm.tm_hour = SecondsFromMidnight / 3600;
386 tm.tm_min = (SecondsFromMidnight % 3600) / 60;
387 tm.tm_sec = SecondsFromMidnight % 60;
398 #define EITPRESENTFOLLOWINGRATE 10 // max. seconds between two occurrences of the "EIT present/following table for the actual multiplex" (2s by the standard, using some more for safety)
416 for (
int i = -1; i <= 7; i++) {
420 time_t b = a + length;
421 if ((!
day || a >=
day) && t < b) {
440 if (Margin || !Directly) {
457 #define FULLMATCH 1000
490 #define EXPIRELATENCY 60 // seconds (just in case there's a short glitch in the VPS signal)
511 #define EPGLIMITBEFORE (1 * 3600) // Time in seconds before a timer's start time and
512 #define EPGLIMITAFTER (1 * 3600) // after its stop time within which EPG events will be taken into consideration.
524 time_t now = time(NULL);
532 if (now <= event->EndTime() ||
Matches(0,
true))
555 if (e->EndTime() < TimeFrameBegin)
557 if (e->StartTime() > TimeFrameEnd)
561 if (overlap && overlap >= Overlap) {
576 if (
event != Event) {
707 if (ti->Channel() == Timer->
Channel() &&
708 (ti->WeekDays() && ti->WeekDays() == Timer->
WeekDays() || !ti->WeekDays() && ti->Day() == Timer->
Day()) &&
709 ti->Start() == Timer->
Start() &&
710 ti->Stop() == Timer->
Stop())
718 static int LastPending = -1;
721 if (!ti->Recording() && ti->Matches(t)) {
723 if (ti->Index() > LastPending) {
724 LastPending = ti->
Index();
762 if ((ti->HasFlags(
tfActive)) && (!t0 || ti->
StopTime() > time(NULL) && ti->Compare(*t0) < 0))
794 bool Result =
state != State;
810 ti->SetEventFromSchedule(Schedules);
838 return (*(
const cTimer **)a)->Compare(**(
const cTimer **)b);
844 for (
const cTimer *Timer = Timers.
First(); Timer; Timer = Timers.
Next(Timer))