summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Lynagh <igloo@earth.li>2012-05-01 17:38:41 +0100
committerIan Lynagh <igloo@earth.li>2012-05-01 17:38:41 +0100
commit89e9295c7e742f38246a066046bd2fae7eb07eeb (patch)
treecd187d4995dabd3ca84250e528972f4e8ab10e09
parent56b05f108a415040b1cd02946ff2627345950663 (diff)
downloadhaskell-89e9295c7e742f38246a066046bd2fae7eb07eeb.tar.gz
Tidy up the ThreadDelay001 test code
-rw-r--r--libraries/base/tests/Concurrent/ThreadDelay001.hs8
1 files changed, 6 insertions, 2 deletions
diff --git a/libraries/base/tests/Concurrent/ThreadDelay001.hs b/libraries/base/tests/Concurrent/ThreadDelay001.hs
index c60f997039..6273ba5e51 100644
--- a/libraries/base/tests/Concurrent/ThreadDelay001.hs
+++ b/libraries/base/tests/Concurrent/ThreadDelay001.hs
@@ -8,8 +8,10 @@ import Control.Concurrent
import Control.Monad
import System.Time
+main :: IO ()
main = mapM_ delay (0 : take 11 (iterate (*5) 1))
+delay :: Int -> IO ()
delay n = do
tS <- getClockTime
threadDelay n
@@ -17,10 +19,12 @@ delay n = do
let req = fromIntegral n * 10 ^ (6 :: Int)
obs = case normalizeTimeDiff (diffClockTimes tE tS) of
- TimeDiff 0 0 0 0 0 s ps -> 10^12 * fromIntegral s + ps
+ TimeDiff 0 0 0 0 0 s ps -> 10 ^ (12 :: Int) * fromIntegral s + ps
+ td ->
+ error ("Bad TimeDiff: " ++ show td)
diff = obs - req
diff' :: Double
- diff' = fromIntegral diff / 10^(12 :: Int)
+ diff' = fromIntegral diff / 10 ^ (12 :: Int)
when (obs < req) $ print (tS, tE, req, obs, diff, diff')