(
Moment context,
long amount
)
| 2614 | //~ Methoden ------------------------------------------------------ |
| 2615 | |
| 2616 | @Override |
| 2617 | public Moment addTo( |
| 2618 | Moment context, |
| 2619 | long amount |
| 2620 | ) { |
| 2621 | |
| 2622 | if (this.unit.compareTo(TimeUnit.SECONDS) >= 0) { |
| 2623 | long secs = |
| 2624 | Math.multiplyExact(amount, this.unit.toSeconds(1)); |
| 2625 | return Moment.of( |
| 2626 | Math.addExact(context.getPosixTime(), secs), |
| 2627 | context.getNanosecond(), |
| 2628 | POSIX |
| 2629 | ); |
| 2630 | } else { // MILLIS, MICROS, NANOS |
| 2631 | long nanos = |
| 2632 | Math.multiplyExact(amount, this.unit.toNanos(1)); |
| 2633 | long sum = Math.addExact(context.getNanosecond(), nanos); |
| 2634 | int nano = (int) Math.floorMod(sum, MRD); |
| 2635 | long second = Math.floorDiv(sum, MRD); |
| 2636 | |
| 2637 | return Moment.of( |
| 2638 | Math.addExact(context.getPosixTime(), second), |
| 2639 | nano, |
| 2640 | POSIX |
| 2641 | ); |
| 2642 | } |
| 2643 | |
| 2644 | } |
| 2645 | |
| 2646 | @Override |
| 2647 | public long between( |
nothing calls this directly
no test coverage detected