diff options
Diffstat (limited to 'src/common/timer.h')
-rw-r--r-- | src/common/timer.h | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/src/common/timer.h b/src/common/timer.h index 9acc7c640..7184beec5 100644 --- a/src/common/timer.h +++ b/src/common/timer.h @@ -12,17 +12,19 @@ #define BASE_TICK 5 -#define TIMER_ONCE_AUTODEL 1 -#define TIMER_INTERVAL 2 -#define TIMER_REMOVE_HEAP 16 +#define TIMER_ONCE_AUTODEL 0x1 +#define TIMER_INTERVAL 0x2 +#define TIMER_REMOVE_HEAP 0x10 #define DIFF_TICK(a,b) ((int)((a)-(b))) // Struct declaration +typedef int (*TimerFunc)(int,unsigned int,int,int); + struct TimerData { unsigned int tick; - int (*func)(int,unsigned int,int,int); + TimerFunc func; int id; int data; int type; @@ -32,16 +34,12 @@ struct TimerData { // Function prototype declaration -#ifdef __WIN32 -void gettimeofday(struct timeval *t, void *dummy); -#endif - unsigned int gettick_nocache(void); unsigned int gettick(void); -int add_timer(unsigned int,int (*)(int,unsigned int,int,int),int,int); -int add_timer_interval(unsigned int,int (*)(int,unsigned int,int,int),int,int,int); -int delete_timer(int,int (*)(int,unsigned int,int,int)); +int add_timer(unsigned int,TimerFunc f,int,int); +int add_timer_interval(unsigned int,TimerFunc f,int,int,int); +int delete_timer(int,TimerFunc f); int addtick_timer(int tid,unsigned int tick); int settick_timer(int tid,unsigned int tick); @@ -49,8 +47,8 @@ struct TimerData *get_timer(int tid); int do_timer(unsigned int tick); -int add_timer_func_list(int (*)(int,unsigned int,int,int),char*); -char* search_timer_func_list(int (*)(int,unsigned int,int,int)); +int add_timer_func_list(TimerFunc func, char* name); +char* search_timer_func_list(TimerFunc f); unsigned long get_uptime(void); |