Statistics
| Branch: | Tag: | Revision:

dvbd / src / timer.h @ a24dbbce

History | View | Annotate | Download (525 Bytes)

1
#if !defined __MY_TIMER_H
2
#define __MY_TIMER_H
3

    
4
#include <sys/time.h>
5
#include <time.h>
6

    
7
class Timer {
8
 public:
9
  typedef void CallbackType( void * );
10
  
11
  Timer( unsigned delayMs, CallbackType *callback, void *arg )
12
    : delayMs(delayMs), callback(callback), arg(arg)
13
    {
14
    }
15

    
16
  void start();
17
  void stop();
18

    
19
  struct timeval getExpiry() const
20
    {
21
      return expiry;
22
    }
23
  
24
  void fire();
25

    
26
 private:
27

    
28
  unsigned delayMs;
29
  CallbackType *callback;
30
  void *arg;
31
  struct timeval expiry;
32
};
33

    
34

    
35
#endif // __MY_TIMER_H