Simplify conversion logic and only use java.time

This commit is contained in:
Németh Noel 2021-07-03 14:45:31 +02:00
parent 3f1c433c94
commit efb450ce50

View File

@ -48,10 +48,10 @@ public class UpdateOption {
* @return the converted milliseconds based on the time value and the unit * @return the converted milliseconds based on the time value and the unit
*/ */
public long toMilliseconds() { public long toMilliseconds() {
return TimeUnit.getMillis(value, temporalUnit); return toDuration().toMillis();
} }
public Duration toDuration() { public Duration toDuration() {
return Duration.ofMillis(toMilliseconds()); return Duration.of(value, temporalUnit);
} }
} }