summaryrefslogtreecommitdiff
path: root/src/utils/timer.h
diff options
context:
space:
mode:
authorPhilipp Sehmisch <tmw@crushnet.org>2006-04-30 03:57:58 +0000
committerPhilipp Sehmisch <tmw@crushnet.org>2006-04-30 03:57:58 +0000
commitecc2253758c536753036ae4ab5ed5e7b1d891c8d (patch)
tree1aa51907f1e8991e270c23af9accf65de756bc60 /src/utils/timer.h
parent9ebb4e544c221ceea0d2bec7a105e203a6b41fc5 (diff)
downloadmanaserv-ecc2253758c536753036ae4ab5ed5e7b1d891c8d.tar.gz
manaserv-ecc2253758c536753036ae4ab5ed5e7b1d891c8d.tar.bz2
manaserv-ecc2253758c536753036ae4ab5ed5e7b1d891c8d.tar.xz
manaserv-ecc2253758c536753036ae4ab5ed5e7b1d891c8d.zip
fixed some problems of the timer class
Diffstat (limited to 'src/utils/timer.h')
-rw-r--r--src/utils/timer.h24
1 files changed, 16 insertions, 8 deletions
diff --git a/src/utils/timer.h b/src/utils/timer.h
index 14f0638a..1fdf7af5 100644
--- a/src/utils/timer.h
+++ b/src/utils/timer.h
@@ -22,7 +22,11 @@
#ifndef _TMWSERV_TIMER_H_
#define _TMWSERV_TIMER_H_
-#include <time.h>
+#include <sys/time.h>
+
+#ifdef _WIN32
+#include "wingettimeofday.h"
+#endif
namespace tmwserv
{
@@ -43,10 +47,9 @@ class Timer
Timer(signed int ms, bool createActive = true);
/**
- * checks if the desired time has passed
- * returns true if yes and false if not
+ * returns the number of elapsed tics since last call
*/
- bool poll();
+ int poll();
/**
* activates the timer
@@ -61,18 +64,23 @@ class Timer
/**
* changes the interval between two pulses
*/
- void changeInterval (signed int ms);
+ void changeInterval (signed int newinterval);
private:
/**
+ * calls gettimeofday() and converts it into milliseconds
+ */
+ signed long long int getTimeInMillisec();
+
+ /**
* interval between two pulses
*/
- signed int interval;
+ signed int interval;
/**
- * time for next pulse
+ * the time the last pulse occured
*/
- signed int nextpulse;
+ signed long long int lastpulse;
/**
* activity status of the timer