timer.tick

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Ryan Moore

    #1

    timer.tick

    is there any way to get a more accurate version of the timer? Basically what
    I need it to do something every 33 milliseconds, but for some reason,
    setting the timer.Interval= 33 does not ensure that my event happens every
    33ms (probably because it takes a while to do the event)

    Is there any sort of a "Wait" method that allows me to pause for a certain
    number of milliseconds?

    thnx


  • Konrad Neitzel

    #2
    Re: timer.tick

    Hi Ryan!

    "Ryan Moore" <ryanmoore@hotm ail.com> schrieb im Newsbeitrag
    news:OhSNYCwrDH A.2148@TK2MSFTN GP12.phx.gbl...
    [color=blue]
    > Is there any sort of a "Wait" method that allows me to pause for a[/color]
    certain[color=blue]
    > number of milliseconds?[/color]

    Maybe you are looking for:

    public static Thread.sleep(in t)

    Thread can be found in System.Threadin g.

    With kind regards,

    Konrad


    Comment

    • Morten Wennevik

      #3
      Re: timer.tick

      If you set timer interval to 1 you can use
      DateTime check = DateTime.Now.Ad dMilliseconds(3 3);

      and in timer.tick check if timespan becomes <= 0;

      TimeSpan span = (check - DateTime.Now);
      if(span <= 0)
      // at least 33 ms have passed

      I don't know how accurate it is for milliseconds, but for seconds you get
      the same exact timespan each time.


      --
      Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/

      Comment

      Working...