getDurationForPrecision static method

int getDurationForPrecision(
  1. int precision,
  2. double durationMs
)

Implementation

static int getDurationForPrecision(int precision, double durationMs)
{
  double numerator = durationMs;

  if (precision != TimePrecision.DAYS) {
    int previousPrecision = getPreviousPrecision(precision);
    numerator = numerator % previousPrecision.toDouble();
  }

  return  ( numerator / precision.toDouble() ).floor();
}