Permalink
Browse files

ClockEstimate: DivByZero

The clock estimator has a potential division by zero.
Using `iteration + 1` seems also more logical to me for
an average.

Found with coverity in a downstream project.
  • Loading branch information...
ax3l authored and horenmar committed Jan 7, 2019
1 parent 3ed5441 commit d1e7344f16d5765ec2a675162a88983bd51baa1d
Showing with 1 addition and 1 deletion.
  1. +1 −1 include/internal/catch_timer.cpp
@@ -40,7 +40,7 @@ namespace Catch {
// is terrible and we should move on.
// TBD: How to signal that the measured resolution is probably wrong?
if (ticks > startTime + 3 * nanosecondsInSecond) {
return sum / i;
return sum / ( i + 1u );
}
}

0 comments on commit d1e7344

Please sign in to comment.