summaryrefslogtreecommitdiff
path: root/src/common/timer.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/common/timer.h')
-rw-r--r--src/common/timer.h48
1 files changed, 25 insertions, 23 deletions
diff --git a/src/common/timer.h b/src/common/timer.h
index 50f1c354b..d0927adde 100644
--- a/src/common/timer.h
+++ b/src/common/timer.h
@@ -1,13 +1,16 @@
// Copyright (c) Hercules Dev Team, licensed under GNU GPL.
// See the LICENSE file
// Portions Copyright (c) Athena Dev Teams
-#ifndef _TIMER_H_
-#define _TIMER_H_
+
+#ifndef COMMON_TIMER_H
+#define COMMON_TIMER_H
+
#include "../common/cbasetypes.h"
-#define DIFF_TICK(a,b) ((int)((a)-(b)))
+#define DIFF_TICK(a,b) ((a)-(b))
+#define DIFF_TICK32(a,b) ((int32)((a)-(b)))
-#define INVALID_TIMER -1
+#define INVALID_TIMER (-1)
// timer flags
enum {
@@ -18,51 +21,50 @@ enum {
// Struct declaration
-typedef int (*TimerFunc)(int tid, unsigned int tick, int id, intptr_t data);
+typedef int (*TimerFunc)(int tid, int64 tick, int id, intptr_t data);
struct TimerData {
- unsigned int tick;
+ int64 tick;
TimerFunc func;
- int type;
+ unsigned char type;
int interval;
- int heap_pos;
// general-purpose storage
- int id;
+ int id;
intptr_t data;
};
/*=====================================
-* Interface : timer.h
+* Interface : timer.h
* Generated by HerculesInterfaceMaker
* created by Susu
*-------------------------------------*/
struct timer_interface {
/* funcs */
- unsigned int (*gettick) (void);
- unsigned int (*gettick_nocache) (void);
+ int64 (*gettick) (void);
+ int64 (*gettick_nocache) (void);
- int (*add_timer) (unsigned int tick, TimerFunc func, int id, intptr_t data);
- int (*add_timer_interval) (unsigned int tick, TimerFunc func, int id, intptr_t data, int interval);
- const struct TimerData *(*get_timer) (int tid);
- int (*delete_timer) (int tid, TimerFunc func);
+ int (*add) (int64 tick, TimerFunc func, int id, intptr_t data);
+ int (*add_interval) (int64 tick, TimerFunc func, int id, intptr_t data, int interval);
+ const struct TimerData *(*get) (int tid);
+ int (*delete) (int tid, TimerFunc func);
- int (*addtick_timer) (int tid, unsigned int tick);
- int (*settick_timer) (int tid, unsigned int tick);
+ int64 (*addtick) (int tid, int64 tick);
+ int64 (*settick) (int tid, int64 tick);
- int (*add_timer_func_list) (TimerFunc func, char* name);
+ int (*add_func_list) (TimerFunc func, char* name);
unsigned long (*get_uptime) (void);
- int (*do_timer) (unsigned int tick);
+ int (*perform) (int64 tick);
void (*init) (void);
void (*final) (void);
-} iTimer_s;
+};
-struct timer_interface *iTimer;
+struct timer_interface *timer;
void timer_defaults(void);
-#endif /* _TIMER_H_ */
+#endif /* COMMON_TIMER_H */