summaryrefslogtreecommitdiff
path: root/src/common/timer.h
diff options
context:
space:
mode:
authorultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-11-03 12:35:34 +0000
committerultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-11-03 12:35:34 +0000
commitcf9b4b50d677a0846c6213acb6bd58fc6ff0d0bb (patch)
treeeeded5380a9eed5e1885b8db9b88ca53e3087a9c /src/common/timer.h
parent92a6b6e9e2593b65e3337dcc45347f22b825a2ed (diff)
downloadhercules-cf9b4b50d677a0846c6213acb6bd58fc6ff0d0bb.tar.gz
hercules-cf9b4b50d677a0846c6213acb6bd58fc6ff0d0bb.tar.bz2
hercules-cf9b4b50d677a0846c6213acb6bd58fc6ff0d0bb.tar.xz
hercules-cf9b4b50d677a0846c6213acb6bd58fc6ff0d0bb.zip
Tried to make sense out of timer.c ... and failed
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@11647 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/common/timer.h')
-rw-r--r--src/common/timer.h31
1 files changed, 15 insertions, 16 deletions
diff --git a/src/common/timer.h b/src/common/timer.h
index e007e9611..4fa4a3c2d 100644
--- a/src/common/timer.h
+++ b/src/common/timer.h
@@ -8,28 +8,29 @@
#include "../common/cbasetypes.h"
#endif
-#define BASE_TICK 5
+#define DIFF_TICK(a,b) ((int)((a)-(b)))
+
+#define INVALID_TIMER -1
+// timer flags
#define TIMER_ONCE_AUTODEL 0x01
#define TIMER_INTERVAL 0x02
#define TIMER_REMOVE_HEAP 0x10
-#define DIFF_TICK(a,b) ((int)((a)-(b)))
-
-#define INVALID_TIMER -1
-
// Struct declaration
-typedef int (*TimerFunc)(int,unsigned int,int,int);
+typedef int (*TimerFunc)(int tid, unsigned int tick, int id, int data);
struct TimerData {
unsigned int tick;
TimerFunc func;
- int id;
- int data;
int type;
int interval;
int heap_pos;
+
+ // general-purpose storage
+ int id;
+ int data;
};
// Function prototype declaration
@@ -37,21 +38,19 @@ struct TimerData {
unsigned int gettick(void);
unsigned int gettick_nocache(void);
-int add_timer(unsigned int,TimerFunc f,int,int);
+int add_timer(unsigned int tick, TimerFunc func, int id, int data);
int add_timer_interval(unsigned int tick, TimerFunc func, int id, int data, int interval);
-int delete_timer(int,TimerFunc f);
-
-int addtick_timer(int tid,unsigned int tick);
-int settick_timer(int tid,unsigned int tick);
-struct TimerData *get_timer(int tid);
+struct TimerData* get_timer(int tid);
+int delete_timer(int tid, TimerFunc func);
-int do_timer(unsigned int tick);
+int addtick_timer(int tid, unsigned int tick);
+int settick_timer(int tid, unsigned int tick);
int add_timer_func_list(TimerFunc func, char* name);
-char* search_timer_func_list(TimerFunc f);
unsigned long get_uptime(void);
+int do_timer();
void timer_init(void);
void timer_final(void);