示例#1
0
 public static Duration from(TemporalAmount amount) {
   Objects.requireNonNull(amount, "amount");
   Duration duration = ZERO;
   for (TemporalUnit unit : amount.getUnits()) {
     duration = duration.plus(amount.get(unit), unit);
   }
   return duration;
 }
示例#2
0
 public static Duration of(long amount, TemporalUnit unit) {
   return ZERO.plus(amount, unit);
 }