Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Glasgow Haskell Compiler
GHC
Commits
89e9295c
Commit
89e9295c
authored
May 01, 2012
by
Ian Lynagh
Browse files
Tidy up the ThreadDelay001 test code
parent
56b05f10
Changes
1
Hide whitespace changes
Inline
Side-by-side
libraries/base/tests/Concurrent/ThreadDelay001.hs
View file @
89e9295c
...
...
@@ -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'
)
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment