[project @ 2000-09-11 15:04:08 by rrt]
authorrrt <unknown>
Mon, 11 Sep 2000 15:04:08 +0000 (15:04 +0000)
committerrrt <unknown>
Mon, 11 Sep 2000 15:04:08 +0000 (15:04 +0000)
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

index 07d6dcd..67a59c6 100644 (file)
@@ -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