#include <timer.hh>
- Author
 - cpellegrino 
 
Definition at line 10 of file timer.hh.
 
◆ Timer() [1/3]
  
  
      
        
          | Timer::Timer  | 
          ( | 
          const Timer & |           t | ) | 
           | 
         
       
   | 
  
inline   | 
  
 
Definition at line 15 of file timer.hh.
   16  {
   18  }
void set(long int seconds, long int useconds)
 
 
 
 
◆ Timer() [2/3]
  
  
      
        
          | Timer::Timer  | 
          ( | 
          long int |           seconds,  | 
         
        
           | 
           | 
          long int |           useconds ) | 
         
       
   | 
  
inline   | 
  
 
Definition at line 20 of file timer.hh.
   21  {
   22    set(seconds, useconds);
 
   23  }
 
 
 
◆ Timer() [3/3]
◆ hasExpired()
      
        
          | bool Timer::hasExpired  | 
          ( | 
           | ) | 
           const | 
        
      
 
Definition at line 21 of file timer.cc.
   22{
   25}
bool hasExpiredWrt(Timer const &t) const
 
 
 
 
◆ hasExpiredWrt()
      
        
          | bool Timer::hasExpiredWrt  | 
          ( | 
          Timer const & |           t | ) | 
           const | 
        
      
 
- Author
 - cpellegrino 
 
Definition at line 7 of file timer.cc.
    8{
    9  if (t.tv_sec > tv_sec)
   10    return true;
   11 
   12  if (t.tv_sec < tv_sec)
   13    return false;
   14 
   15  if (t.tv_usec > tv_usec)
   16    return true;
   17 
   18  return false;
   19}
 
 
 
◆ set() [1/2]
      
        
          | void Timer::set  | 
          ( | 
          long int |           seconds,  | 
        
        
           | 
           | 
          long int |           useconds ) | 
        
      
 
Definition at line 27 of file timer.cc.
   28{
   29  static const int usec_in_a_sec = 1000000;
   30 
   31  gettimeofday(this, 0);
   32 
   33  tv_sec  +=  seconds;
   34  tv_usec += useconds;
   35  tv_sec  += (tv_usec) / usec_in_a_sec;
   36  tv_usec %= usec_in_a_sec;
   37}
 
 
 
◆ set() [2/2]
  
  
      
        
          | void Timer::set  | 
          ( | 
          const Timer & |           t | ) | 
           | 
         
       
   | 
  
inline   | 
  
 
Definition at line 36 of file timer.hh.
   37  {
   38    tv_sec  =  t.tv_sec;
   39    tv_usec = t.tv_usec;
   40  }
 
 
 
The documentation for this class was generated from the following files: