use .net's Stopwatch instead of sdl's broken timer

This commit is contained in:
Bob
2010-04-09 14:51:56 +12:00
parent d53212ff00
commit 4f9fb8f08d

View File

@@ -18,25 +18,24 @@
*/ */
#endregion #endregion
using Tao.Sdl;
namespace OpenRA.Support namespace OpenRA.Support
{ {
public class Stopwatch public class Stopwatch
{ {
int start; System.Diagnostics.Stopwatch sw;
public Stopwatch() public Stopwatch ()
{ {
Reset(); Reset();
} }
public double ElapsedTime() public double ElapsedTime()
{ {
return (1.0/1000.0) * (double)(Sdl.SDL_GetTicks() - start); return sw.Elapsed.TotalMilliseconds / 1000.0;
} }
public void Reset() public void Reset()
{ {
start = Sdl.SDL_GetTicks(); sw = System.Diagnostics.Stopwatch.StartNew();
} }
} }
} }