diff options
| author | Reid Barton <rwbarton@gmail.com> | 2013-10-01 21:10:49 -0400 |
|---|---|---|
| committer | Austin Seipp <aseipp@pobox.com> | 2013-10-05 11:28:18 -0500 |
| commit | 0fcb06e456fb7589b110c02d99d78f59d59445cb (patch) | |
| tree | 4a0d7a59d54bad0c2d4c4fafbb53d81a9ae67f8e | |
| parent | a333f7bc77432bdd1af7f34968227196a2f3487d (diff) | |
| download | haskell-0fcb06e456fb7589b110c02d99d78f59d59445cb.tar.gz | |
Port ThreadDelay001 to the "time" library
... as "old-time" isn't built when cross-compiling.
Issue #8395.
Signed-off-by: Austin Seipp <aseipp@pobox.com>
| -rw-r--r-- | libraries/base/tests/Concurrent/ThreadDelay001.hs | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/libraries/base/tests/Concurrent/ThreadDelay001.hs b/libraries/base/tests/Concurrent/ThreadDelay001.hs index 36aa152b81..3b0f806e22 100644 --- a/libraries/base/tests/Concurrent/ThreadDelay001.hs +++ b/libraries/base/tests/Concurrent/ThreadDelay001.hs @@ -6,22 +6,19 @@ module Main (main) where import Control.Concurrent import Control.Monad -import System.Time +import Data.Time main :: IO () main = mapM_ delay (0 : take 7 (iterate (*5) 100)) delay :: Int -> IO () delay n = do - tS <- getClockTime + tS <- getCurrentTime threadDelay n - tE <- getClockTime + tE <- getCurrentTime let req = fromIntegral n * 10 ^ (6 :: Int) - obs = case normalizeTimeDiff (diffClockTimes tE tS) of - TimeDiff 0 0 0 0 0 s ps -> 10 ^ (12 :: Int) * fromIntegral s + ps - td -> - error ("Bad TimeDiff: " ++ show td) + obs = floor (diffUTCTime tE tS * 10 ^ (12 :: Int)) diff = obs - req diff' :: Double diff' = fromIntegral diff / 10 ^ (12 :: Int) |
