// possible precision loss;
// otherwise as a double.
if (numberString.matches("[0-9]+")) {
return units.toNanos(Long.parseLong(numberString));
} else {
final long nanosInUnit = units.toNanos(1);
return (long) (Double.parseDouble(numberString) * nanosInUnit);
}
} catch (NumberFormatException e) {
throw new ConfigException.BadValue(originForException,
pathForException, "Could not parse duration number '"