From a65414d85482eca34a0b1258408a335313332f8e Mon Sep 17 00:00:00 2001 From: Alexander Eckart Date: Fri, 23 Mar 2012 11:58:47 +0100 Subject: [PATCH] fixed benchmark timer calculations --- Vocaluxe/Base/CLog.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Vocaluxe/Base/CLog.cs b/Vocaluxe/Base/CLog.cs index 34663b91..d75e2f36 100644 --- a/Vocaluxe/Base/CLog.cs +++ b/Vocaluxe/Base/CLog.cs @@ -56,7 +56,7 @@ namespace Vocaluxe.Base private static int _NumErrors; private static Stopwatch[] _BenchmarkTimer; - private static long nanosecPerTick = (1000L * 1000L * 1000L) / Stopwatch.Frequency; + private static double nanosecPerTick = (1000.0 * 1000.0 * 1000.0) / Stopwatch.Frequency; public static void Init() { @@ -129,8 +129,8 @@ namespace Vocaluxe.Base } float ms; - if (Stopwatch.IsHighResolution) - ms = (float)(((double)nanosecPerTick * (double)_BenchmarkTimer[BenchmarkNr].ElapsedTicks) / (1000.0 * 1000.0)); + if (Stopwatch.IsHighResolution && nanosecPerTick != 0.0) + ms = (float)((nanosecPerTick * _BenchmarkTimer[BenchmarkNr].ElapsedTicks) / (1000.0 * 1000.0)); else ms = (float)_BenchmarkTimer[BenchmarkNr].ElapsedMilliseconds;