Re: Time accuracy



ML wrote:
PM app, a ball is dropped at moment T at the top of the screen (Y=0).
At moment T+1, Y will be 1. At moment T+2, Y is about 4: accelaration.
For a smooth display the ball also has to be displayed at Y=2 and Y=3,
so it doesn't jump from Y=1 to Y=4 (and next Y=9, Y=16, ...).

What's the preferred way nowadays to delay each step? I don't really need extreme nor time-critical accuracy, "close enough" will do. I did think about a hires timer, but elsewere I read something like "I hope
WarpVision isn't using the hires timer". I don't know if that remark
made sense, I just read it.

Is the hires timer the way to go anyway, or do I need to DosSleep() in
thread 1 and perform some benchmark counting in thread 2, or is there another way to get delays smaller than DosSleep()'s lores delays?



---
Hi,

I have a program called European Juggle which simulates a human juggler very well. This is a PM program, and it doesn't use timers.

A threaded application in OS/2 gets a slice every 32ms, and that makes a pretty smooth display. Use DosSleep(1) to give up the timeslice at each step. You have to work it backwards - calculate where the ball will be next assuming 32 ms have elapsed.

Very occasionally, you can get a short 'hiccup' on a slow PC when a thread overruns.

http://www.manglais.com/download/MAEJ100.ZIP

Peter
.



Relevant Pages

  • Time accuracy
    ... a ball is dropped at moment T at the top of the screen. ... For a smooth display the ball also has to be displayed at Y=2 and Y=3, ... WarpVision isn't using the hires timer". ... another way to get delays smaller than DosSleep's lores delays? ...
    (comp.os.os2.programmer.misc)
  • Re: Time accuracy
    ... For a smooth display the ball also has to be displayed at Y=2 and Y=3, ... What's the preferred way nowadays to delay each step? ... WarpVision isn't using the hires timer". ... another way to get delays smaller than DosSleep's lores delays? ...
    (comp.os.os2.programmer.misc)
  • Re: Time accuracy
    ... WarpVision isn't using the hires timer". ... thread 1 and perform some benchmark counting in thread 2, or is there another way to get delays smaller than DosSleep's lores delays? ... Create the necessary semaphore and data structures ... For anything requiring more than 15 frames per second of animation, the only way to do it reliably on nearly all versions of OS/2 is to interface with the TIMER0 device driver. ...
    (comp.os.os2.programmer.misc)
  • [GIT pull] timers core for 2.6.36
    ... timers: ... +delays - Information on the various kernel delay / sleep mechanisms ... +it really need to delay in atomic context?" ... void msleep; ...
    (Linux-Kernel)
  • Re: sampling rate problem
    ... thread's data will be accessible to this thread unless you syncronize. ... Since it is unlikely that you will ever get exact timing from sleep or timer ... I had a similar problem getting accurate timer delays while measuring wind ...
    (comp.lang.java.programmer)