From: rrt Date: Mon, 11 Sep 2000 15:04:08 +0000 (+0000) Subject: [project @ 2000-09-11 15:04:08 by rrt] X-Git-Tag: Approximately_9120_patches~3755 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=1448475b9047918eabdd6caadb3bafa8689ddf50;p=ghc-hetmet.git [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. --- 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