Skip to content

Instantly share code, notes, and snippets.

@ZacharyKamerling
Created November 3, 2013 09:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ZacharyKamerling/7288243 to your computer and use it in GitHub Desktop.
Save ZacharyKamerling/7288243 to your computer and use it in GitHub Desktop.
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