Ticket #13409: 20190220-dvbci-datetime.patch

File 20190220-dvbci-datetime.patch, 1.4 KB (added by Klaas de Waal, 10 months ago)

Fix offset of local time to UTC in DateTime? string to CAM, typecast in SendData? removed.

  • mythtv/libs/libmythtv/recorders/dvbdev/dvbci.cpp

    diff --git a/mythtv/libs/libmythtv/recorders/dvbdev/dvbci.cpp b/mythtv/libs/libmythtv/recorders/dvbdev/dvbci.cpp
    index bcaa70f319..1039d9168a 100644
    a b bool cCiDateTime::SendDateTime(void) 
    11421142     int L = (M == 1 || M == 2) ? 1 : 0;
    11431143     int MJD = 14956 + D + int((Y - L) * 365.25) + int((M + 1 + L * 12) * 30.6001);
    11441144#define DEC2BCD(d) (uint8_t((((d) / 10) << 4) + ((d) % 10)))
    1145      struct tTime { unsigned short mjd; uint8_t h, m, s; short offset; };
    1146      tTime T;
    1147      T.mjd = htons(MJD);
    1148      T.h = DEC2BCD(tm_gmt.tm_hour);
    1149      T.m = DEC2BCD(tm_gmt.tm_min);
    1150      T.s = DEC2BCD(tm_gmt.tm_sec);
    1151      T.offset = static_cast<short>(htons(tm_loc.tm_gmtoff / 60));
     1145#define BYTE0(a) ((a) & 0xFF)
     1146#define BYTE1(a) (((a) >> 8) & 0xFF)
     1147     uint8_t T[7];
     1148     uint16_t mjd = htons(MJD);
     1149     int16_t local_offset = htons(tm_loc.tm_gmtoff / 60);
     1150     T[0] = BYTE0(mjd);
     1151     T[1] = BYTE1(mjd);
     1152     T[2] = DEC2BCD(tm_gmt.tm_hour);
     1153     T[3] = DEC2BCD(tm_gmt.tm_min);
     1154     T[4] = DEC2BCD(tm_gmt.tm_sec);
     1155     T[5] = BYTE0(local_offset);
     1156     T[6] = BYTE1(local_offset);
    11521157
    11531158     dbgprotocol("%d: ==> Date Time\n", SessionId());
    1154      SendData(AOT_DATE_TIME, 7, (uint8_t*)&T);
     1159     SendData(AOT_DATE_TIME, 7, T);
    11551160     //XXX return value of all SendData() calls???
    11561161     return true;
    11571162     }