durationMinutesFromMs function

double durationMinutesFromMs(
  1. num ms
)

Converts wall-clock milliseconds to TestResult.durationMinutes: one decimal, half-up.

The explicit floor(x + 0.5) keeps the formula identical across languages (Python round and kotlin.math.round are banker's rounding, and Dart's double.round() is half-away-from-zero only for positives). Non-finite and non-positive input reports 0 — never null for a reported result.

Implementation

double durationMinutesFromMs(num ms) {
  final value = ms.toDouble();
  if (value.isNaN || value.isInfinite || value <= 0) return 0;
  final tenths = (value / 60000) * 10;
  return (tenths + 0.5).floorToDouble() / 10;
}