[Haskell-cafe] threadDelay correctness

2010-06-11 Thread Roman Cheplyaka
* David Powell [2010-06-11 16:09:55+1000] > This is a slightly different issue, but isn't there a potential problem with > threadDelay? I noticed that internally threadDelay uses gettimeofday() as > the absolute time source (on linux at least). Isn't there potential > problem with this since wa

Re: [Haskell-cafe] threadDelay granularity

2009-04-07 Thread Peter Verswyvelen
yes "get time" comes from GLFW; that is get comes from OpenGL, time from GLFW. I think the time provided by GLFW has a very high resolution but is not very accurate in the long run, which is not a real problem for games I guess On Tue, Apr 7, 2009 at 6:09 PM, Duane Johnson wrote: > The Hipmunk 2D

Re: [Haskell-cafe] threadDelay granularity

2009-04-07 Thread Duane Johnson
The Hipmunk 2D physics engine comes with a "playground" app which includes the following function: -- | Advances the time. advanceTime :: IORef State -> Double -> KeyButtonState -> IO Double advanceTime stateVar oldTime slowKey = do newTime <- get time -- Advance simulation let slower =

Re: [Haskell-cafe] threadDelay granularity

2009-04-07 Thread Ulrik Rasmussen
On Tue, Apr 07, 2009 at 04:34:22PM +0200, Peter Verswyvelen wrote: > Do you want to cap the rendering framerate at 60FPS or the animation > framerate? > Because when you use OpenGL and GLFW, you can just > > GLFW.swapInterval $= 1 > > to cap the rendering framerate at the refresh rate of your mon

Re: [Haskell-cafe] threadDelay granularity

2009-04-07 Thread Peter Verswyvelen
Do you want to cap the rendering framerate at 60FPS or the animation framerate? Because when you use OpenGL and GLFW, you can just GLFW.swapInterval $= 1 to cap the rendering framerate at the refresh rate of your monitor or LCD screen (usually 60Hz) On Tue, Apr 7, 2009 at 1:41 PM, Ulrik Rasmuss

Re: [Haskell-cafe] threadDelay granularity

2009-04-07 Thread Ulrik Rasmussen
On Tue, Apr 07, 2009 at 04:01:01PM +0200, Peter Verswyvelen wrote: > Are you on Windows? Because this might be because GHC is not using a high > resolution timer for doing its scheduling, I don't know... No, Ubuntu 8.10. That may very well be, I'm not that much into the details of GHC. I'm think

Re: [Haskell-cafe] threadDelay granularity

2009-04-07 Thread Peter Verswyvelen
I think this is an RTS option. http://www.haskell.org/ghc/docs/latest/html/users_guide/using-concurrent.html On Tue, Apr 7, 2009 at 1:41 PM, Ulrik Rasmussen wrote: > Hello. > > I am writing a simple game in Haskell as an exercise, and in the > rendering loop I want to cap the framerate to 60fp

[Haskell-cafe] threadDelay granularity

2009-04-07 Thread Ulrik Rasmussen
Hello. I am writing a simple game in Haskell as an exercise, and in the rendering loop I want to cap the framerate to 60fps. I had planned to do this with GHC.Conc.threadDelay, but looking at it's documentation, I discovered that it can only delay the thread in time spans that are multiples of 20m

Re: [Haskell-cafe] threadDelay

2009-02-09 Thread Bulat Ziganshin
Hello Immanuel, Monday, February 9, 2009, 3:42:24 PM, you wrote: > Am I correct in assuming this program should run 100 secs? > real    0m0.104s may be, 100 msecs? :) -- | Suspends the current thread for a given number of microseconds -- (GHC only). -- Best regards, Bulat

Re: [Haskell-cafe] threadDelay

2009-02-09 Thread Svein Ove Aas
2009/2/9 Immanuel Litzroth : > Am I correct in assuming this program should run 100 secs? > No, you're off by a factor of a thousand. It's based on microseconds, not milliseconds. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.o

[Haskell-cafe] threadDelay

2009-02-09 Thread Immanuel Litzroth
Am I correct in assuming this program should run 100 secs? >import Control.Concurrent >main = do > threadDelay 10 Why do I get the folling result then? ghc -threaded Main.hs -o delay time ./delay real0m0.104s user0m0.001s sys0m0.002s Thanks in advance for all your wonderful