formatTime static method

String formatTime(
  1. int timeInMillis
)

Format time in milliseconds

Implementation

static String formatTime(int timeInMillis) {
  if (timeInMillis < 0) {
    return "-1 ms";
  }
  if (timeInMillis <= _secondAsMillisecond) {
    return "$timeInMillis ms";
  }
  if (timeInMillis <= _minuteAsMillisecond) {
    return "${_formatDouble(timeInMillis / _secondAsMillisecond)} s";
  }

  Duration duration = Duration(milliseconds: timeInMillis);

  return "${duration.inMinutes} min ${(duration.inSeconds.remainder(60))} s "
      "${duration.inMilliseconds.remainder(1000)} ms";
}