1 #ifndef __LIB_DVB_DVBTIME_H_
2 #define __LIB_DVB_DVBTIME_H_
4 #include <lib/base/eerror.h>
5 #include <lib/dvb/esection.h>
6 #include <dvbsi++/time_date_section.h>
10 inline int fromBCD(int bcd)
16 return ((bcd&0xF0)>>4)*10+(bcd&0xF);
19 time_t parseDVBtime(__u8 t1, __u8 t2, __u8 t3, __u8 t4, __u8 t5);
21 class TDT: public eGTable
24 ePtr<iDVBDemux> demux;
25 eTimer m_interval_timer;
26 int createTable(int nr, const __u8 *data, unsigned int max);
30 TDT(eDVBChannel *chan, int update_count=0);
32 void startTimer(int interval);
33 int getUpdateCount() { return update_count; }
36 class eDVBLocalTimeHandler: public Object
41 ePtr<eDVBChannel> channel;
42 ePtr<eConnection> m_stateChangedConn;
43 int m_prevChannelState;
46 DECLARE_REF(eDVBLocalTimeHandler)
47 std::map<iDVBChannel*, channel_data> m_knownChannels;
48 std::map<eDVBChannelID,int> m_timeOffsetMap;
49 ePtr<eConnection> m_chanAddedConn;
51 int m_time_difference;
52 int m_last_tp_time_difference;
53 void DVBChannelAdded(eDVBChannel*);
54 void DVBChannelStateChanged(iDVBChannel*);
55 void readTimeOffsetData(const char*);
56 void writeTimeOffsetData(const char*);
57 void updateTime(time_t tp_time, eDVBChannel*, int updateCount);
58 static eDVBLocalTimeHandler *instance;
60 PSignal0<void> m_timeUpdated;
61 eDVBLocalTimeHandler();
62 ~eDVBLocalTimeHandler();
63 bool ready() const { return m_time_ready; }
64 int difference() const { return m_time_difference; }
65 static eDVBLocalTimeHandler *getInstance() { return instance; }
68 #endif // __LIB_DVB_DVBTIME_H_