SASC-NG
DVBSoftCAM

SI::DVBTime Namespace Reference

Functions

time_t getTime (unsigned char date_hi, unsigned char date_lo, unsigned char timehr, unsigned char timemi, unsigned char timese)
time_t getDuration (unsigned char timehr, unsigned char timemi, unsigned char timese)
unsigned char bcdToDec (unsigned char b)

Function Documentation

unsigned char SI::DVBTime::bcdToDec ( unsigned char  b) [inline]
time_t SI::DVBTime::getDuration ( unsigned char  timehr,
unsigned char  timemi,
unsigned char  timese 
)

Definition at line 213 of file util.c.

References bcdToDec().

Referenced by SI::PremiereCIT::getDuration(), and SI::EIT::Event::getDuration().

                                                                                                         {
   return
     bcdToDec(time_second)
   + bcdToDec(time_minute) * 60
   + bcdToDec(time_hour) *3600;
}
time_t SI::DVBTime::getTime ( unsigned char  date_hi,
unsigned char  date_lo,
unsigned char  timehr,
unsigned char  timemi,
unsigned char  timese 
)

Definition at line 190 of file util.c.

References bcdToDec(), and k.

Referenced by SI::EIT::Event::getStartTime(), SI::PremiereContentTransmissionDescriptor::StartDayEntry::StartTimeEntry::getStartTime(), SI::TOT::getTime(), SI::TDT::getTime(), and SI::LocalTimeOffsetDescriptor::LocalTimeOffset::getTimeOfChange().

                                                                                                                                                   {
   u_int16_t mjd = date_hi << 8 | date_lo;
   struct tm t;

   t.tm_sec = bcdToDec(time_second);
   t.tm_min = bcdToDec(time_minute);
   t.tm_hour = bcdToDec(time_hour);

   int k;
   t.tm_year = (int) ((mjd - 15078.2) / 365.25);
   t.tm_mon = (int) ((mjd - 14956.1 - (int)(t.tm_year * 365.25)) / 30.6001);
   t.tm_mday = (int) (mjd - 14956 - (int)(t.tm_year * 365.25) - (int)(t.tm_mon * 30.6001));
   k = (t.tm_mon == 14 || t.tm_mon == 15) ? 1 : 0;
   t.tm_year = t.tm_year + k;
   t.tm_mon = t.tm_mon - 1 - k * 12;
   t.tm_mon--;

   t.tm_isdst = -1;
   t.tm_gmtoff = 0;

   return timegm(&t);
}
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines