From 1448475b9047918eabdd6caadb3bafa8689ddf50 Mon Sep 17 00:00:00 2001 From: rrt Date: Mon, 11 Sep 2000 15:04:08 +0000 Subject: [PATCH] [project @ 2000-09-11 15:04:08 by rrt] Implemented gettimeofday on Windows by calling GetTickCount(). This only seems to have a resolution of 1/100s, but that's just about OK for threadDelay, which only needs 50 ticks per second. --- ghc/rts/Itimer.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/ghc/rts/Itimer.c b/ghc/rts/Itimer.c index 07d6dcd..67a59c6 100644 --- a/ghc/rts/Itimer.c +++ b/ghc/rts/Itimer.c @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------------- - * $Id: Itimer.c,v 1.17 2000/08/25 13:12:07 simonmar Exp $ + * $Id: Itimer.c,v 1.18 2000/09/11 15:04:08 rrt Exp $ * * (c) The GHC Team, 1995-1999 * @@ -59,8 +59,7 @@ handle_tick(int unused STG_UNUSED); /* ----------------------------------------------------------------------------- Tick handler - We use the ticker for two things: supporting threadDelay, and time - profiling. + We use the ticker for time profiling. SMP note: this signal could be delivered to *any* thread. We have to ensure that it doesn't matter which thread actually runs the @@ -243,6 +242,7 @@ unblock_vtalrm_signal(void) /* gettimeofday() takes around 1us on our 500MHz PIII. Since we're * only calling it 50 times/s, it shouldn't have any great impact. */ +#if !defined(mingw32_TARGET_OS) unsigned int getourtimeofday(void) { @@ -251,3 +251,10 @@ getourtimeofday(void) return (tv.tv_sec * TICK_FREQUENCY + tv.tv_usec * TICK_FREQUENCY / 1000000); } +#else +unsigned int +getourtimeofday(void) +{ + return (unsigned int)GetTickCount() * 1000; +} +#endif -- 1.7.10.4