fix warnings, add toBCD function
authorAndreas Monzner <andreas.monzner@multimedia-labs.de>
Tue, 25 Jul 2006 00:57:42 +0000 (00:57 +0000)
committerAndreas Monzner <andreas.monzner@multimedia-labs.de>
Tue, 25 Jul 2006 00:57:42 +0000 (00:57 +0000)
lib/dvb/dvbtime.cpp
lib/dvb/dvbtime.h

index eb0ed69..7f8ebb9 100644 (file)
@@ -204,7 +204,7 @@ void eDVBLocalTimeHandler::updateTime( time_t tp_time, eDVBChannel *chan, int up
                                        now.tm_min,
                                        now.tm_sec);
                                m_time_difference = rtc_time - linuxTime;
-                               eDebug("[eDVBLocalTimerHandler] RTC to Receiver time difference is %d seconds", nowTime - rtc_time );
+                               eDebug("[eDVBLocalTimerHandler] RTC to Receiver time difference is %ld seconds", nowTime - rtc_time );
                                if ( abs(m_time_difference) > 59 )
                                {
                                        eDebug("[eDVBLocalTimerHandler] set Linux Time to RTC Time");
@@ -270,7 +270,7 @@ void eDVBLocalTimeHandler::updateTime( time_t tp_time, eDVBChannel *chan, int up
                                        time_t rtc=getRTC();
                                        m_timeOffsetMap[chan->getChannelID()] = rtc-tp_time;
                                        new_diff = rtc-nowTime;  // set enigma time to rtc
-                                       eDebug("[eDVBLocalTimerHandler] update stored correction to %d (calced against RTC time)", rtc-tp_time );
+                                       eDebug("[eDVBLocalTimerHandler] update stored correction to %ld (calced against RTC time)", rtc-tp_time );
                                }
                                else if ( abs(ddiff) <= 120 )
                                {
index ec47de4..c441965 100644 (file)
@@ -18,6 +18,13 @@ inline int fromBCD(int bcd)
        return ((bcd&0xF0)>>4)*10+(bcd&0xF);
 }
 
+inline int toBCD(int dec)
+{
+       if (dec >= 100)
+               return -1;
+       return int(dec/10)*0x10 + dec%10;
+}
+
 time_t parseDVBtime(__u8 t1, __u8 t2, __u8 t3, __u8 t4, __u8 t5);
 
 class TDT: public eGTable