summaryrefslogtreecommitdiff
path: root/src/timer.c
diff options
context:
space:
mode:
authorfcolin1998-06-16 09:26:08 +0000
committerfcolin1998-06-16 09:26:08 +0000
commitf8e8025b75c0a4588849843853b72a3039bdb7f6 (patch)
tree1b13d5fe61bf51693e01acb4d836fe1fbcc96c2c /src/timer.c
parentfe2f9c773e09827055859cc5ceb4893f0381a8a2 (diff)
downloadivy-c-f8e8025b75c0a4588849843853b72a3039bdb7f6.zip
ivy-c-f8e8025b75c0a4588849843853b72a3039bdb7f6.tar.gz
ivy-c-f8e8025b75c0a4588849843853b72a3039bdb7f6.tar.bz2
ivy-c-f8e8025b75c0a4588849843853b72a3039bdb7f6.tar.xz
Modif timer.c
Diffstat (limited to 'src/timer.c')
-rw-r--r--src/timer.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/src/timer.c b/src/timer.c
index a1fb791..dfa10bd 100644
--- a/src/timer.c
+++ b/src/timer.c
@@ -1,12 +1,13 @@
/* Module de gestion des timers autour d'un select */
#include <stdio.h>
#include <sys/types.h>
-#include <sys/timeb.h>
-#include <stdlib.h>
#include <time.h>
+#include <stdlib.h>
#include <memory.h>
#ifdef WIN32
#include <windows.h>
+#else
+#include <sys/time.h>
#endif
#include "list.h"
#include "timer.h"
@@ -33,17 +34,15 @@ TimerId timers = NULL;
static long currentTime()
{
- struct timeval tv;
- unsigned long current;
- gettimeofday (&tv, 0);
- current = 1000 * tv.tv_sec + tv.tv_usec / 1000;
- return current;
-
-#if 0
unsigned long current;
- current = clock();
- return current;
+#ifdef WIN32
+ current = GetTickCount();
+#else
+ struct timeval stamp;
+ gettimeofday( &stamp, NULL );
+ current = stamp.tv_sec * MILLISEC + stamp.tv_usec/MILLISEC;
#endif
+ return current;
}
static void SetNewTimeout( unsigned long current, unsigned long when )
{