Results 1 to 5 of 5

Thread: [2005] Timer accuracy differences?

Threaded View

  1. #1

    Thread Starter
    Frenzied Member stimbo's Avatar
    Join Date
    Jun 2006
    Location
    UK
    Posts
    1,739

    [2005] Timer accuracy differences?

    My friend has asked me to code a small program. It needs to simply display a letter after a certain amount of time and then asks the user to press the Spacebar as quickly as possible once the item appears on the screen.

    That's not the issue, I can code that fine. I'm really just wondering about the accuracy of the timer. I mean, should I use TimeSpan, GetTimeStamp to work out the difference in time between onset and pressing of the key or the stopwatch (Elapsed time) or something else entirely??

    From MSDN: "The Stopwatch measures elapsed time by counting timer ticks in the underlying timer mechanism. If the installed hardware and operating system support a high-resolution performance counter, then the Stopwatch class uses that counter to measure elapsed time. Otherwise, the Stopwatch class uses the system timer to measure elapsed time."

    Which would suggest Stopwatch would be better if run on a reasonably good computer because if possible it will use the better of the two options when available? It also runs under System.Diagnostics which is different from the timer class suggesting a more hardware based approach (system ticks)...?

    I guess my question is which timing method would be best?? Think I've just got myself a little confused.
    Last edited by stimbo; Mar 1st, 2007 at 05:33 AM.
    Stim

    Free VB.NET Book Chapter
    Visual Basic 2005 Cookbook Sample Chapter

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width