toMilliseconds static method
To milliseconds.
@param units the units @param value the value @return the long
Implementation
static int toMilliseconds(int units, int value) {
int millis;
switch (units) {
case TimeSpan.MILLISECONDS:
case TimeSpan.SECONDS:
case TimeSpan.MINUTES:
case TimeSpan.HOURS:
case TimeSpan.DAYS:
millis = value * units;
break;
default:
throw new ArgumentException("Unrecognized units: $units");
}
return millis;
}