20 #define VFAT_MAX_FILENAME 40 // same as MAX_SUBTITLE_LENGTH in recording.c
41 time_t t = time(NULL);
43 struct tm *now = localtime_r(&t, &tm_r);
46 start = now->tm_hour * 100 + now->tm_min;
52 if (
const cEvent *
Event = Schedule->GetPresentEvent()) {
64 struct tm *time = localtime_r(&tstart, &tm_r);
65 start = time->tm_hour * 100 + time->tm_min;
66 time = localtime_r(&tstop, &tm_r);
67 stop = time->tm_hour * 100 + time->tm_min;
84 dsyslog(
"timer file name too long for VFAT file system: '%s'",
file);
104 time_t tstop = tstart + Event->
Duration();
110 struct tm *time = localtime_r(&tstart, &tm_r);
113 start = time->tm_hour * 100 + time->tm_min;
114 time = localtime_r(&tstop, &tm_r);
115 stop = time->tm_hour * 100 + time->tm_min;
120 const char *Title = Event->
Title();
124 dsyslog(
"timer file name too long for VFAT file system: '%s'",
file);
126 dsyslog(
"timer file name truncated to '%s'",
file);
147 if (&Timer !=
this) {
166 aux = Timer.
aux ? strdup(Timer.
aux) : NULL;
186 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 :
"");
198 return (t / 100 * 60 + t % 100) * 60;
215 const char *a = strchr(s,
'@');
216 const char *d = a ? a + 1 : isdigit(*s) ? s : NULL;
218 if (strlen(d) == 10) {
220 if (3 == sscanf(d,
"%d-%d-%d", &tm_r.tm_year, &tm_r.tm_mon, &tm_r.tm_mday)) {
221 tm_r.tm_year -= 1900;
223 tm_r.tm_hour = tm_r.tm_min = tm_r.tm_sec = 0;
233 int day = strtol(d, &tail, 10);
234 if (tail && *tail || day < 1 || day > 31)
236 time_t t = time(NULL);
237 int DaysToCheck = 61;
238 for (
int i = -1; i <= DaysToCheck; i++) {
247 if (a || !isdigit(*s)) {
248 if ((a && a - s == 7) || strlen(s) == 7) {
249 for (
const char *p = s + 6; p >= s; p--) {
251 WeekDays |= (*p !=
'-');
262 #define DAYBUFFERSIZE 64
267 const char *w =
trNOOP(
"MTWTFSS");
268 if (!SingleByteChars)
273 for (
int i = 0; i < sl; i++)
287 localtime_r(&Day, &tm_r);
288 b += strftime(b,
DAYBUFFERSIZE - (b - buffer),
"%Y-%m-%d", &tm_r);
306 char *channelbuffer = NULL;
307 char *daybuffer = NULL;
308 char *filebuffer = NULL;
319 while (l2 > 0 && isspace(s[l2 - 1]))
321 if (s[l2 - 1] ==
':') {
322 s2 =
MALLOC(
char, l2 + 3);
323 strcat(
strn0cpy(s2, s, l2 + 1),
" \n");
327 if (8 <= sscanf(s,
"%u :%a[^:]:%a[^:]:%d :%d :%d :%d :%a[^:\n]:%a[^\n]", &
flags, &channelbuffer, &daybuffer, &
start, &
stop, &
priority, &
lifetime, &filebuffer, &
aux)) {
342 dsyslog(
"timer file name too long for VFAT file system: '%s'", p);
344 dsyslog(
"timer file name truncated to '%s'", p);
354 esyslog(
"ERROR: channel %s not defined", channelbuffer);
367 return fprintf(f,
"%s", *
ToText(
true)) > 0;
378 return localtime_r(&t, &tm_r)->tm_mday;
384 int weekday = localtime_r(&t, &tm_r)->tm_wday;
385 return weekday == 0 ? 6 : weekday - 1;
396 tm tm = *localtime_r(&t, &tm_r);
408 tm tm = *localtime_r(&t, &tm_r);
409 tm.tm_hour = SecondsFromMidnight / 3600;
410 tm.tm_min = (SecondsFromMidnight % 3600) / 60;
411 tm.tm_sec = SecondsFromMidnight % 60;
422 #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)
440 for (
int i = -1; i <= 7; i++) {
444 time_t b = a + length;
445 if ((!
day || a >=
day) && t < b) {
464 if (Margin || !Directly) {
480 #define FULLMATCH 1000
513 #define EXPIRELATENCY 60 // seconds (just in case there's a short glitch in the VPS signal)
534 #define EPGLIMITBEFORE (1 * 3600) // Time in seconds before a timer's start time and
535 #define EPGLIMITAFTER (1 * 3600) // after its stop time within which EPG events will be taken into consideration.
547 time_t now = time(NULL);
565 if (!Event &&
event && (now <= event->EndTime() ||
Matches(0,
true)))
576 if (e->EndTime() < TimeFrameBegin)
578 if (e->StartTime() > TimeFrameEnd)
582 if (overlap && overlap >= Overlap) {
597 if (
event != Event) {
728 if (ti->Channel() == Timer->
Channel() &&
729 (ti->WeekDays() && ti->WeekDays() == Timer->
WeekDays() || !ti->WeekDays() && ti->Day() == Timer->
Day()) &&
730 ti->Start() == Timer->
Start() &&
731 ti->Stop() == Timer->
Stop())
739 static int LastPending = -1;
742 if (!ti->Recording() && ti->Matches(t)) {
744 if (ti->Index() > LastPending)
745 LastPending = ti->
Index();
763 int tm = ti->Matches(Event);
781 if ((ti->HasFlags(
tfActive)) && (!t0 || ti->
StopTime() > time(NULL) && ti->Compare(*t0) < 0))
813 bool Result =
state != State;
829 ti->SetEventFromSchedule(Schedules);
857 return (*(
const cTimer **)a)->Compare(**(
const cTimer **)b);
863 for (
const cTimer *Timer = Timers.
First(); Timer; Timer = Timers.
Next(Timer))