Timeout check
 Class which makes it easy to check if a specified amount of time has passed.  
More...
Timeout check
 Class which makes it easy to check if a specified amount of time has passed. 
This code uses the support of platform-independent chrono system introduced with C++11.
Example: 
 
{
public:
  CExample()
  {
    TimerCall();
  }
 
  void TimerCall()
  {
    fprintf(stderr, "Hello World\n");
    CEndTime timer(1000);
 
    while (timer.MillisLeft())
    {
      if (timer.IsTimePast())
      {
        fprintf(stderr, "We timed out!\n");
      }
      std::this_thread::sleep_for(std::chrono::milliseconds(10));
    }
  }
 
};
#define ATTR_DLL_LOCAL
Definition addon_base.h:86
 
  
◆ CEndTime() [1/2]
  
  
      
        
          | kodi::tools::CEndTime::CEndTime  | 
          ( | 
           | ) | 
           | 
         
       
   | 
  
inlinedefault   | 
  
 
Class constructor with no time to expiry set. 
 
 
◆ CEndTime() [2/2]
  
  
      
        
          | kodi::tools::CEndTime::CEndTime  | 
          ( | 
          unsigned int |           millisecondsIntoTheFuture | ) | 
           | 
         
       
   | 
  
inlineexplicit   | 
  
 
Class constructor to set future time when timer has expired. 
- Parameters
 - 
  
    | [in] | millisecondsIntoTheFuture | the time in the future we cosider this timer as expired  | 
  
   
 
 
◆ GetInitialTimeoutValue()
  
  
      
        
          | unsigned int kodi::tools::CEndTime::GetInitialTimeoutValue  | 
          ( | 
          void |            | ) | 
           const | 
         
       
   | 
  
inline   | 
  
 
Get the initial timeout value this timer had. 
- Returns
 - The initial expiry amount of time this timer had in milliseconds 
 
 
 
◆ GetStartTime()
  
  
      
        
          | uint64_t kodi::tools::CEndTime::GetStartTime  | 
          ( | 
          void |            | ) | 
           const | 
         
       
   | 
  
inline   | 
  
 
Get the time this timer started. 
- Returns
 - The time this timer started in milliseconds since epoch 
 
 
 
◆ IsInfinite()
  
  
      
        
          | bool kodi::tools::CEndTime::IsInfinite  | 
          ( | 
          void |            | ) | 
           const | 
         
       
   | 
  
inline   | 
  
 
Check if the timer has been set to infinite expiry. 
- Returns
 - True if the expiry has been set as infinite, false otherwise 
 
 
 
◆ IsTimePast()
  
  
      
        
          | bool kodi::tools::CEndTime::IsTimePast  | 
          ( | 
           | ) | 
           const | 
         
       
   | 
  
inline   | 
  
 
Check if the expiry time has been reached. 
- Returns
 - True if the expiry amount of time has past, false otherwise 
 
 
 
◆ MillisLeft()
  
  
      
        
          | unsigned int kodi::tools::CEndTime::MillisLeft  | 
          ( | 
           | ) | 
           const | 
         
       
   | 
  
inline   | 
  
 
The amount of time left till this timer expires. 
- Returns
 - 0 if the expiry amount of time has past, the number of milliseconds remaining otherwise 
 
 
 
◆ Set()
  
  
      
        
          | void kodi::tools::CEndTime::Set  | 
          ( | 
          unsigned int |           millisecondsIntoTheFuture | ) | 
           | 
         
       
   | 
  
inline   | 
  
 
Set the time in the future we cosider this timer as expired. 
- Parameters
 - 
  
    | [in] | millisecondsIntoTheFuture | the time in the future we cosider this timer as expired  | 
  
   
 
 
◆ SetExpired()
  
  
      
        
          | void kodi::tools::CEndTime::SetExpired  | 
          ( | 
           | ) | 
           | 
         
       
   | 
  
inline   | 
  
 
Consider this timer expired. 
 
 
◆ SetInfinite()
  
  
      
        
          | void kodi::tools::CEndTime::SetInfinite  | 
          ( | 
           | ) | 
           | 
         
       
   | 
  
inline   | 
  
 
Set this timer as never expiring.