X-Git-Url: https://git.martlubbers.net/?a=blobdiff_plain;f=stimer%2Ftest.icl;fp=stimer%2Ftest.icl;h=0000000000000000000000000000000000000000;hb=4b62b5d397d86147e393c05b3083af74a3a0c4af;hp=3bc5d32dff66d9c3fe63bf3f36eef87e7c6f5c68;hpb=e5305ee9d4290e1aa803a2e62a14f32e5cd29782;p=clean-tests.git diff --git a/stimer/test.icl b/stimer/test.icl deleted file mode 100644 index 3bc5d32..0000000 --- a/stimer/test.icl +++ /dev/null @@ -1,29 +0,0 @@ -module test - -import StdFunc => qualified return -import Data.Func -import System.Time -import iTasks -import iTasks.Internal.IWorld - -Start w = flip startEngine w - $ foreverSt 0 \i-> - waitForSTimer 0.1 - -|| viewInformation () [] (toString i +++ "th waitForSTimer") - >>| treturn (i+1) - -waitForSTimer :: Real -> Task () -waitForSTimer secondsToWait -= get currentTimespec - >>= \ts->watch (sdsFocus {start=ts,interval=realToTs secondsToWait} iworldTimespec) - >>* [OnValue (ifValue (\t->t > ts+realToTs secondsToWait) \_->treturn ())] -where - realToTs :: Real -> Timespec - realToTs t = - {tv_sec = floor t - ,tv_nsec = toInt $ (t - toReal (floor t)) * 1E9 - } - floor :: Real -> Int - floor x - | toReal (toInt x) == x = (toInt x) - | otherwise = toInt (x - 0.5)