fixed calculating FPS

This commit is contained in:
Alexander Eckart committed 2012-03-20 16:03:59 +01:00
1 parent 0dc51aefc0
commit 081a2fc2ba
1 file changed
+2 -2
+2 -2
View File
@@ -119,7 +119,7 @@ namespace Vocaluxe.Base
{ {
private static Stopwatch _Stopwatch = new Stopwatch(); private static Stopwatch _Stopwatch = new Stopwatch();
private static float _fps = 0.0f; private static float _fps = 0.0f;
private static long nanosecPerTick = (1000L * 1000L * 1000L) / Stopwatch.Frequency; private static double nanosecPerTick = (1000.0 * 1000.0 * 1000.0) / Stopwatch.Frequency;
public static void Reset() public static void Reset()
{ {
@@ -149,7 +149,7 @@ namespace Vocaluxe.Base
{ {
long ticks = _Stopwatch.ElapsedTicks; long ticks = _Stopwatch.ElapsedTicks;
if (Stopwatch.IsHighResolution && ticks != 0) if (Stopwatch.IsHighResolution && ticks != 0)
return (float)(((double)nanosecPerTick * (double)ticks) / (1000.0 * 1000.0)); return (float)((nanosecPerTick * ticks) / (1000.0 * 1000.0));
else else
return (float)_Stopwatch.ElapsedMilliseconds; return (float)_Stopwatch.ElapsedMilliseconds;
} }