r136: This commit was manufactured by cvs2svn to create tag 'hv_1_1_8'.
[cinelerra_cv/ct.git] / hvirtual / guicast / timer.h
blob17bcef9fcfb267ee5641831949a90cc9075b4150
1 #ifndef TIMER_H
2 #define TIMER_H
4 #include <stdint.h>
5 #include <sys/time.h>
8 class Timer
10 public:
11 Timer();
12 virtual ~Timer();
14 int update(); // set last update to now
16 // get difference between now and last update in milliseconds
17 // must be positive or error results
18 int64_t get_difference(struct timeval *result); // also stores in timeval
19 int64_t get_difference();
21 // get difference in arbitrary units between now and last update
22 int64_t get_scaled_difference(long denominator);
23 int delay(long milliseconds);
25 private:
26 struct timeval current_time;
27 struct timeval new_time;
28 struct timeval delay_duration;
33 #endif