SASC-NG
DVBSoftCAM

cTransponderTime Class Reference

Inheritance diagram for cTransponderTime:

List of all members.

Public Member Functions

 cTransponderTime (int Source, int Transponder)
bool Is (int Source, int Transponder) const
void Set (time_t st)
time_t Now (void)
void SetHasHandler (bool on)
bool HasHandler (void) const

Detailed Description

Definition at line 51 of file tps.c.


Constructor & Destructor Documentation

cTransponderTime::cTransponderTime ( int  Source,
int  Transponder 
)

Definition at line 68 of file tps.c.

{
  source=Source; transponder=Transponder;
#ifdef TRUST_BOXTIME
  sattime=time(0);
#else
  sattime=-1;
#endif
  hasHandler=false;
}

Member Function Documentation

bool cTransponderTime::HasHandler ( void  ) const [inline]

Definition at line 65 of file tps.c.

Referenced by cSatTime::Now().

{ return hasHandler; }
bool cTransponderTime::Is ( int  Source,
int  Transponder 
) const

Definition at line 79 of file tps.c.

Referenced by cSatTime::cSatTime().

{
  return source==Source && transponder==Transponder;
}
time_t cTransponderTime::Now ( void  )

Definition at line 101 of file tps.c.

References cTimeMs::Elapsed(), L_SYS_TIME, PRINTF, and cCondVar::TimedWait().

Referenced by cSatTime::Now(), and Set().

{
  cMutexLock lock(&mutex);
  if(sattime<0) {
    if(!wait.TimedWait(mutex,3*1000)) {
      PRINTF(L_SYS_TIME,"%x:%x: unsuccessfull wait",source,transponder);
      return -1;
      }
    }
  return sattime+(reftime.Elapsed()/1000);
}
void cTransponderTime::Set ( time_t  st)

Definition at line 84 of file tps.c.

References cCondVar::Broadcast(), cTimeMs::Elapsed(), L_SYS_TIME, Now(), PRINTF, cTimeMs::Set(), and stripspace().

Referenced by cSatTimeHook::Process().

{
  cMutexLock lock(&mutex);
  if(sattime<0 || reftime.Elapsed()>5*1000) {
    reftime.Set(-100);
    sattime=st;
    wait.Broadcast();

    char str[32];
    struct tm utm;
    st=Now();
    time_t now=time(0);
    gmtime_r(&st,&utm); asctime_r(&utm,str); stripspace(str);
    PRINTF(L_SYS_TIME,"%x:%x: %s (delta %ld)",source,transponder,str,st-now);
    }
}
void cTransponderTime::SetHasHandler ( bool  on) [inline]

Definition at line 64 of file tps.c.

Referenced by cSatTimeHook::cSatTimeHook(), and cSatTimeHook::~cSatTimeHook().

{ hasHandler=on; }

The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines