+++ /dev/null
-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)