add poor man's BST support
This commit is contained in:
parent
9c85217f8b
commit
d3c3cbe94e
3
Makefile
3
Makefile
|
@ -12,7 +12,8 @@ MAKE=gmake
|
|||
DEFS=-D_REENTRANT -D_TS_ERRNO -DHMT_PROTECT
|
||||
# -DWITH_MPATROL
|
||||
|
||||
SRCS= descriptor.c \
|
||||
SRCS= bst.c \
|
||||
descriptor.c \
|
||||
epg.c \
|
||||
file.c \
|
||||
huffman.c \
|
||||
|
|
|
@ -0,0 +1,41 @@
|
|||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include <unistd.h>
|
||||
#include <time.h>
|
||||
#include <strings.h>
|
||||
|
||||
#include "lint.h"
|
||||
|
||||
struct bsttab {
|
||||
time_t tm;
|
||||
int bst;
|
||||
};
|
||||
|
||||
#include "bst.h"
|
||||
|
||||
int
|
||||
is_bst(time_t tm)
|
||||
{
|
||||
int i, is_bst;
|
||||
|
||||
is_bst = 0;
|
||||
for (i = 0; bst[i].tm; i++)
|
||||
{
|
||||
if (bst[i].tm > tm)
|
||||
break;
|
||||
is_bst = bst[i].bst;
|
||||
}
|
||||
|
||||
return is_bst;
|
||||
}
|
||||
|
||||
void
|
||||
bstise(time_t *tm)
|
||||
{
|
||||
if (is_bst(*tm))
|
||||
*tm += 3600;
|
||||
}
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
struct bsttab bst[] = {
|
||||
{ 1301187600, 1 },
|
||||
{ 1319936400, 0 },
|
||||
{ 1332637200, 1 },
|
||||
{ 1351386000, 0 },
|
||||
{ 1364691600, 1 },
|
||||
{ 1382835600, 0 },
|
||||
{ 1396141200, 1 },
|
||||
{ 1414285200, 0 },
|
||||
{ 1427590800, 1 },
|
||||
{ 1445734800, 0 },
|
||||
{ 1459040400, 1 },
|
||||
{ 1477789200, 0 },
|
||||
{ 1490490000, 1 },
|
||||
{ 1509238800, 0 },
|
||||
{ 1521939600, 1 },
|
||||
{ 1540688400, 0 },
|
||||
{ 1553994000, 1 },
|
||||
{ 1572138000, 0 },
|
||||
{ 0, 0 },
|
||||
};
|
3
lint.h
3
lint.h
|
@ -44,6 +44,9 @@ void free_descriptor(struct descriptor *);
|
|||
unsigned char *freeview_huffman_to_string(const unsigned char *, uint,
|
||||
unsigned int *);
|
||||
|
||||
int is_bst(time_t);
|
||||
void bstise(time_t *);
|
||||
|
||||
#ifdef sun
|
||||
char *strcasestr (char *, char *);
|
||||
#endif
|
||||
|
|
1
main.c
1
main.c
|
@ -82,6 +82,7 @@ dump(struct epg *epg __attribute__((unused)),
|
|||
time_t tm;
|
||||
|
||||
tm = mjd(d->start_date, d->start_hour, d->start_min, d->start_sec);
|
||||
bstise(&tm);
|
||||
|
||||
if (ds[PARSER_SHORT_EVENT])
|
||||
{
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Generate British Summer Time switchover table
|
||||
|
||||
year=2011
|
||||
|
||||
echo "struct bsttab bst[] = {"
|
||||
while [ $year -lt 2020 ]; do
|
||||
dststart=`cal 3 $year | grep '[0-9]' | tail -1 | awk '{print $1}'`
|
||||
dstend=`cal 10 $year | grep '[0-9]' | tail -1 | awk '{print $1}'`
|
||||
echo " { `date -d ${year}03${dststart}0100 +%s`, 1 },"
|
||||
echo " { `date -d ${year}10${dstend}0100 +%s`, 0 },"
|
||||
year=`expr $year + 1`
|
||||
done
|
||||
echo " { 0, 0 },"
|
||||
echo "};"
|
||||
|
Loading…
Reference in New Issue