From 769c3b48e690967fc19e885581efef299043bf28 Mon Sep 17 00:00:00 2001
From: sof <unknown>
Date: Wed, 22 Jul 1998 20:40:38 +0000
Subject: [PATCH] [project @ 1998-07-22 20:40:26 by sof] IO.hInputReady:
 interval arg is millisecs, not secs

---
 ghc/lib/std/IO.lhs              | 6 +++---
 ghc/lib/std/cbits/inputReady.lc | 8 ++++----
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/ghc/lib/std/IO.lhs b/ghc/lib/std/IO.lhs
index 22b7745b3cfd..d98b15cb0074 100644
--- a/ghc/lib/std/IO.lhs
+++ b/ghc/lib/std/IO.lhs
@@ -166,7 +166,7 @@ instance Read BufferMode where
 Computation @hReady hdl@ indicates whether at least
 one item is available for input from handle {\em hdl}.
 
-@hWaitForInput@ is the generalisation, wait for \tr{n} seconds
+@hWaitForInput@ is the generalisation, wait for \tr{n} milliseconds
 before deciding whether the Handle has run dry or not.
 
 \begin{code}
@@ -174,9 +174,9 @@ before deciding whether the Handle has run dry or not.
 hReady h = hWaitForInput h 0
 
 --hWaitForInput :: Handle -> Int -> IO Bool 
-hWaitForInput handle nsecs = do
+hWaitForInput handle msecs = do
     hdl   <- wantReadableHandle handle
-    rc    <- _ccall_ inputReady (filePtr hdl) nsecs
+    rc    <- _ccall_ inputReady (filePtr hdl) msecs
     writeHandle handle (markHandle hdl)
     case rc of
       0 -> return False
diff --git a/ghc/lib/std/cbits/inputReady.lc b/ghc/lib/std/cbits/inputReady.lc
index 8baa5829716d..7d9b685880c6 100644
--- a/ghc/lib/std/cbits/inputReady.lc
+++ b/ghc/lib/std/cbits/inputReady.lc
@@ -36,9 +36,9 @@
 #endif
 
 StgInt
-inputReady(fp, nsecs)
+inputReady(fp, msecs)
 StgForeignObj fp;
-StgInt nsecs;
+StgInt msecs;
 {
     int flags, c, fd, maxfd, ready;
     fd_set rfd;
@@ -75,8 +75,8 @@ StgInt nsecs;
     FD_SET(fd, &rfd);
     /* select() will consider the descriptor set in the range of 0 to (maxfd-1) */
     maxfd = fd + 1;
-    tv.tv_usec = 0;
-    tv.tv_sec  = nsecs;
+    tv.tv_sec  = msecs / 1000;
+    tv.tv_usec = msecs % 1000;
     while ((ready = select(maxfd, &rfd, NULL, NULL, &tv)) < 0 ) {
       if (errno != EINTR ) {
 		cvtErrno();
-- 
GitLab