Create a gist now

Instantly share code, notes, and snippets.

loop :: Integer -> Integer -> IO ()
loop time steps = do
timeNow <- getCPUTime
threadDelay $ max 0 $ fromIntegral $ (steps * 1000000) - ((timeNow - time) `div` 1000000)
loop time (steps + 1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment