user2997725
user2997725

Reputation: 37

How do i calculate the exact elapsed time

The language is C#. I've got a problem: I need to calculate the elapsed microseconds for a game which is running with a very high framerate. The problem: it's so fast that the Stopwatch always returns 0 -> under 1 millisecond. I've used google to solve my question but other people always did this:

milliseconds * 1000

which isn't gonna work since milliseconds is always 0 ...

Upvotes: 2

Views: 527

Answers (1)

gleng
gleng

Reputation: 6304

Use Ticks.

A detailed article can be found here on how to use them: http://msdn.microsoft.com/en-us/library/system.diagnostics.stopwatch.elapsedticks%28v=vs.110%29.aspx

EDIT

Or as Tim S. suggested, you could count how many frames happen in a second.

Upvotes: 2

Related Questions