/libcore/ojluni/src/test/java/time/tck/java/time/ |
D | MockSimplePeriod.java | 95 private final TemporalUnit unit; field in MockSimplePeriod 107 public static MockSimplePeriod of(long amount, TemporalUnit unit) { in of() argument 108 return new MockSimplePeriod(amount, unit); in of() 111 private MockSimplePeriod(long amount, TemporalUnit unit) { in MockSimplePeriod() argument 112 Objects.requireNonNull(unit, "unit"); in MockSimplePeriod() 113 if (unit == FOREVER) { in MockSimplePeriod() 117 this.unit = unit; in MockSimplePeriod() 121 public long get(TemporalUnit unit) { in get() argument 136 return unit; in getUnit() 142 return temporal.plus(amount, unit); in addTo() [all …]
|
/libcore/ojluni/src/test/java/time/test/java/time/ |
D | MockSimplePeriod.java | 95 private final TemporalUnit unit; field in MockSimplePeriod 107 public static MockSimplePeriod of(long amount, TemporalUnit unit) { in of() argument 108 return new MockSimplePeriod(amount, unit); in of() 111 private MockSimplePeriod(long amount, TemporalUnit unit) { in MockSimplePeriod() argument 112 Objects.requireNonNull(unit, "unit"); in MockSimplePeriod() 113 if (unit == FOREVER) { in MockSimplePeriod() 117 this.unit = unit; in MockSimplePeriod() 121 public long get(TemporalUnit unit) { in get() argument 136 return unit; in getUnit() 142 return temporal.plus(amount, unit); in addTo() [all …]
|
/libcore/ojluni/src/main/java/java/nio/file/attribute/ |
D | FileTime.java | 57 private final TimeUnit unit; field in FileTime 77 private FileTime(long value, TimeUnit unit, Instant instant) { in FileTime() argument 79 this.unit = unit; in FileTime() 95 public static FileTime from(long value, TimeUnit unit) { in from() argument 96 Objects.requireNonNull(unit, "unit"); in from() 97 return new FileTime(value, unit, null); in from() 141 public long to(TimeUnit unit) { in to() argument 142 Objects.requireNonNull(unit, "unit"); in to() 143 if (this.unit != null) { in to() 144 return unit.convert(this.value, this.unit); in to() [all …]
|
/libcore/ojluni/src/main/java/java/time/temporal/ |
D | Temporal.java | 152 boolean isSupported(TemporalUnit unit); in isSupported() argument 297 Temporal plus(long amountToAdd, TemporalUnit unit); in plus() argument 369 default Temporal minus(long amountToSubtract, TemporalUnit unit) { in minus() argument 370 …oSubtract == Long.MIN_VALUE ? plus(Long.MAX_VALUE, unit).plus(1, unit) : plus(-amountToSubtract, u… in minus() 447 long until(Temporal endExclusive, TemporalUnit unit); in until() argument
|
/libcore/ojluni/src/main/java/java/time/ |
D | Year.java | 397 public boolean isSupported(TemporalUnit unit) { in isSupported() argument 398 if (unit instanceof ChronoUnit) { in isSupported() 399 … return unit == YEARS || unit == DECADES || unit == CENTURIES || unit == MILLENNIA || unit == ERAS; in isSupported() 401 return unit != null && unit.isSupportedBy(this); in isSupported() 702 public Year plus(long amountToAdd, TemporalUnit unit) { in plus() argument 703 if (unit instanceof ChronoUnit chronoUnit) { in plus() 711 throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit); in plus() 713 return unit.addTo(this, amountToAdd); in plus() 778 public Year minus(long amountToSubtract, TemporalUnit unit) { in minus() argument 779 …oSubtract == Long.MIN_VALUE ? plus(Long.MAX_VALUE, unit).plus(1, unit) : plus(-amountToSubtract, u… in minus() [all …]
|
D | YearMonth.java | 385 public boolean isSupported(TemporalUnit unit) { in isSupported() argument 386 if (unit instanceof ChronoUnit) { in isSupported() 387 …return unit == MONTHS || unit == YEARS || unit == DECADES || unit == CENTURIES || unit == MILLENNI… in isSupported() 389 return unit != null && unit.isSupportedBy(this); in isSupported() 799 public YearMonth plus(long amountToAdd, TemporalUnit unit) { in plus() argument 800 if (unit instanceof ChronoUnit chronoUnit) { in plus() 809 throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit); in plus() 811 return unit.addTo(this, amountToAdd); in plus() 897 public YearMonth minus(long amountToSubtract, TemporalUnit unit) { in minus() argument 898 …oSubtract == Long.MIN_VALUE ? plus(Long.MAX_VALUE, unit).plus(1, unit) : plus(-amountToSubtract, u… in minus() [all …]
|
D | Instant.java | 489 public boolean isSupported(TemporalUnit unit) { in isSupported() argument 490 if (unit instanceof ChronoUnit) { in isSupported() 491 return unit.isTimeBased() || unit == DAYS; in isSupported() 493 return unit != null && unit.isSupportedBy(this); in isSupported() 741 public Instant truncatedTo(TemporalUnit unit) { in truncatedTo() argument 742 if (unit == ChronoUnit.NANOS) { in truncatedTo() 745 Duration unitDur = unit.getDuration(); in truncatedTo() 843 public Instant plus(long amountToAdd, TemporalUnit unit) { in plus() argument 844 if (unit instanceof ChronoUnit) { in plus() 845 switch ((ChronoUnit) unit) { in plus() [all …]
|
D | Duration.java | 304 public static Duration of(long amount, TemporalUnit unit) { in of() argument 305 return ZERO.plus(amount, unit); in of() 332 for (TemporalUnit unit : amount.getUnits()) { in from() 333 duration = duration.plus(amount.get(unit), unit); in from() 528 public long get(TemporalUnit unit) { in get() argument 529 if (unit == SECONDS) { in get() 531 } else if (unit == NANOS) { in get() 534 throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit); in get() 692 public Duration plus(long amountToAdd, TemporalUnit unit) { in plus() argument 693 Objects.requireNonNull(unit, "unit"); in plus() [all …]
|
D | OffsetTime.java | 426 public boolean isSupported(TemporalUnit unit) { in isSupported() argument 427 if (unit instanceof ChronoUnit) { in isSupported() 428 return unit.isTimeBased(); in isSupported() 430 return unit != null && unit.isSupportedBy(this); in isSupported() 817 public OffsetTime truncatedTo(TemporalUnit unit) { in truncatedTo() argument 818 return with(time.truncatedTo(unit), offset); in truncatedTo() 873 public OffsetTime plus(long amountToAdd, TemporalUnit unit) { in plus() argument 874 if (unit instanceof ChronoUnit) { in plus() 875 return with(time.plus(amountToAdd, unit), offset); in plus() 877 return unit.addTo(this, amountToAdd); in plus() [all …]
|
D | LocalTime.java | 571 public boolean isSupported(TemporalUnit unit) { in isSupported() argument 572 if (unit instanceof ChronoUnit) { in isSupported() 573 return unit.isTimeBased(); in isSupported() 575 return unit != null && unit.isSupportedBy(this); in isSupported() 966 public LocalTime truncatedTo(TemporalUnit unit) { in truncatedTo() argument 967 if (unit == ChronoUnit.NANOS) { in truncatedTo() 970 Duration unitDur = unit.getDuration(); in truncatedTo() 1061 public LocalTime plus(long amountToAdd, TemporalUnit unit) { in plus() argument 1062 if (unit instanceof ChronoUnit chronoUnit) { in plus() 1072 throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit); in plus() [all …]
|
D | OffsetDateTime.java | 520 public boolean isSupported(TemporalUnit unit) { in isSupported() argument 521 if (unit instanceof ChronoUnit) { in isSupported() 522 return unit != FOREVER; in isSupported() 524 return unit != null && unit.isSupportedBy(this); in isSupported() 1126 public OffsetDateTime truncatedTo(TemporalUnit unit) { in truncatedTo() argument 1127 return with(dateTime.truncatedTo(unit), offset); in truncatedTo() 1182 public OffsetDateTime plus(long amountToAdd, TemporalUnit unit) { in plus() argument 1183 if (unit instanceof ChronoUnit) { in plus() 1184 return with(dateTime.plus(amountToAdd, unit), offset); in plus() 1186 return unit.addTo(this, amountToAdd); in plus() [all …]
|
D | ZonedDateTime.java | 740 public boolean isSupported(TemporalUnit unit) { in isSupported() argument 741 return ChronoZonedDateTime.super.isSupported(unit); in isSupported() 1519 public ZonedDateTime truncatedTo(TemporalUnit unit) { in truncatedTo() argument 1520 return resolveLocal(dateTime.truncatedTo(unit)); in truncatedTo() 1591 public ZonedDateTime plus(long amountToAdd, TemporalUnit unit) { in plus() argument 1592 if (unit instanceof ChronoUnit) { in plus() 1593 if (unit.isDateBased()) { in plus() 1594 return resolveLocal(dateTime.plus(amountToAdd, unit)); in plus() 1596 return resolveInstant(dateTime.plus(amountToAdd, unit)); in plus() 1599 return unit.addTo(this, amountToAdd); in plus() [all …]
|
/libcore/ojluni/src/main/java/java/time/chrono/ |
D | ChronoLocalDate.java | 412 default boolean isSupported(TemporalUnit unit) { in isSupported() argument 413 if (unit instanceof ChronoUnit) { in isSupported() 414 return unit.isDateBased(); in isSupported() 416 return unit != null && unit.isSupportedBy(this); in isSupported() 461 default ChronoLocalDate plus(long amountToAdd, TemporalUnit unit) { in plus() argument 462 if (unit instanceof ChronoUnit) { in plus() 463 throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit); in plus() 465 return ChronoLocalDateImpl.ensureValid(getChronology(), unit.addTo(this, amountToAdd)); in plus() 485 default ChronoLocalDate minus(long amountToSubtract, TemporalUnit unit) { in minus() argument 486 …urn ChronoLocalDateImpl.ensureValid(getChronology(), Temporal.super.minus(amountToSubtract, unit)); in minus() [all …]
|
D | ChronoLocalDateImpl.java | 199 public D plus(long amountToAdd, TemporalUnit unit) { in plus() argument 200 if (unit instanceof ChronoUnit chronoUnit) { in plus() 211 throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit); in plus() 213 return (D) ChronoLocalDate.super.plus(amountToAdd, unit); in plus() 224 public D minus(long amountToSubtract, TemporalUnit unit) { in minus() argument 225 return (D) ChronoLocalDate.super.minus(amountToSubtract, unit); in minus() 376 public long until(Temporal endExclusive, TemporalUnit unit) { in until() argument 379 if (unit instanceof ChronoUnit chronoUnit) { in until() 390 throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit); in until() 392 Objects.requireNonNull(unit, "unit"); in until() [all …]
|
D | ChronoPeriod.java | 137 long get(TemporalUnit unit); in get() argument 173 for (TemporalUnit unit : getUnits()) { in isZero() 174 if (get(unit) != 0) { in isZero() 187 for (TemporalUnit unit : getUnits()) { in isNegative() 188 if (get(unit) < 0) { in isNegative()
|
D | ChronoLocalDateTime.java | 257 default boolean isSupported(TemporalUnit unit) { in isSupported() argument 258 if (unit instanceof ChronoUnit) { in isSupported() 259 return unit != FOREVER; in isSupported() 261 return unit != null && unit.isSupportedBy(this); in isSupported() 300 ChronoLocalDateTime<D> plus(long amountToAdd, TemporalUnit unit); in plus() argument 318 default ChronoLocalDateTime<D> minus(long amountToSubtract, TemporalUnit unit) { in minus() argument 319 …ChronoLocalDateTimeImpl.ensureValid(getChronology(), Temporal.super.minus(amountToSubtract, unit)); in minus()
|
/libcore/ojluni/src/test/java/time/tck/java/time/temporal/ |
D | TCKChronoUnit.java | 123 …public void test_unitType(ChronoUnit unit, boolean isDateBased, boolean isTimeBased, boolean isDur… in test_unitType() argument 124 assertEquals(unit.isDateBased(), isDateBased); in test_unitType() 125 assertEquals(unit.isTimeBased(), isTimeBased); in test_unitType() 126 assertEquals(unit.isDurationEstimated(), isDurationEstimated); in test_unitType() 169 …public void test_unitAndTemporal(ChronoUnit unit, Temporal base, boolean isSupportedBy, long amoun… in test_unitAndTemporal() argument 170 assertEquals(unit.isSupportedBy(base), isSupportedBy); in test_unitAndTemporal() 172 Temporal result = unit.addTo(base, amount); in test_unitAndTemporal() 174 assertEquals(unit.between(base, result), amount); in test_unitAndTemporal() 183 for (ChronoUnit unit : ChronoUnit.values()) { in test_valueOf() 184 assertEquals(ChronoUnit.valueOf(unit.name()), unit); in test_valueOf() local
|
/libcore/luni/src/test/java/libcore/java/time/ |
D | OffsetTimeTest.java | 70 private static void assertPlusIsNoop(long amount, TemporalUnit unit) { in assertPlusIsNoop() argument 71 assertSame(NOON_UTC, NOON_UTC.plus(amount, unit)); in assertPlusIsNoop() 76 for (ChronoUnit unit : EnumSet.range(ChronoUnit.DAYS, ChronoUnit.FOREVER)) { in test_plus_minus_invalidUnits() 78 NOON_UTC.plus(1, unit); in test_plus_minus_invalidUnits() 79 fail("Adding 1 " + unit + " should have failed."); in test_plus_minus_invalidUnits() 83 NOON_UTC.minus(1, unit); in test_plus_minus_invalidUnits() 84 fail("Subtracting 1 " + unit + " should have failed."); in test_plus_minus_invalidUnits()
|
/libcore/ojluni/src/test/java/nio/file/attribute/ |
D | FileTimeTest.java | 116 for (TimeUnit unit: TimeUnit.values()) { in main() 117 for (int i=0; i<100; i++) { to(rand.nextLong(), unit); } in main() local 118 to(Long.MIN_VALUE, unit); in main() 119 to(Long.MAX_VALUE, unit); in main() 124 for (TimeUnit unit : EnumSet.allOf(TimeUnit.class)) { in main() 127 FileTime ft = FileTime.from(value, unit); in main() 130 eqTime(value, unit, instant); in main() 134 for (TimeUnit unit : EnumSet.allOf(TimeUnit.class)) { in main() 136 FileTime ft = FileTime.from(value, unit); in main() 138 if (unit.compareTo(TimeUnit.SECONDS) < 0) { in main() [all …]
|
/libcore/ojluni/src/main/java/java/util/concurrent/ |
D | BlockingDeque.java | 315 boolean offerFirst(E e, long timeout, TimeUnit unit) in offerFirst() argument 337 boolean offerLast(E e, long timeout, TimeUnit unit) in offerLast() argument 371 E pollFirst(long timeout, TimeUnit unit) in pollFirst() argument 387 E pollLast(long timeout, TimeUnit unit) in pollLast() argument 504 boolean offer(E e, long timeout, TimeUnit unit) in offer() argument 555 E poll(long timeout, TimeUnit unit) in poll() argument
|
D | ScheduledExecutorService.java | 107 long delay, TimeUnit unit); in schedule() argument 123 long delay, TimeUnit unit); in schedule() argument 167 TimeUnit unit); in scheduleAtFixedRate() argument 207 TimeUnit unit); in scheduleWithFixedDelay() argument
|
D | ScheduledThreadPoolExecutor.java | 247 public long getDelay(TimeUnit unit) { in getDelay() argument 248 return unit.convert(time - System.nanoTime(), NANOSECONDS); in getDelay() 527 private long triggerTime(long delay, TimeUnit unit) { in triggerTime() argument 528 return triggerTime(unit.toNanos((delay < 0) ? 0 : delay)); in triggerTime() 562 TimeUnit unit) { in schedule() argument 563 if (command == null || unit == null) in schedule() 567 triggerTime(delay, unit), in schedule() 579 TimeUnit unit) { in schedule() argument 580 if (callable == null || unit == null) in schedule() 584 triggerTime(delay, unit), in schedule() [all …]
|
D | Executors.java | 697 public boolean awaitTermination(long timeout, TimeUnit unit) 700 return e.awaitTermination(timeout, unit); 725 long timeout, TimeUnit unit) 728 return e.invokeAll(tasks, timeout, unit); 738 long timeout, TimeUnit unit) 741 return e.invokeAny(tasks, timeout, unit); 769 public ScheduledFuture<?> schedule(Runnable command, long delay, TimeUnit unit) { 770 return e.schedule(command, delay, unit); 772 public <V> ScheduledFuture<V> schedule(Callable<V> callable, long delay, TimeUnit unit) { 773 return e.schedule(callable, delay, unit); [all …]
|
/libcore/ojluni/src/main/java/java/lang/ |
D | Process.java | 186 public boolean waitFor(long timeout, TimeUnit unit) in waitFor() argument 190 long rem = unit.toNanos(timeout); in waitFor() 201 rem = unit.toNanos(timeout) - (System.nanoTime() - startTime); in waitFor()
|
/libcore/ojluni/src/main/java/sun/nio/ch/ |
D | AsynchronousSocketChannelImpl.java | 219 TimeUnit unit, in implRead() argument 228 TimeUnit unit, in read() argument 276 return implRead(isScatteringRead, dst, dsts, timeout, unit, att, handler); in read() 289 TimeUnit unit, in read() argument 297 read(false, dst, null, timeout, unit, attachment, handler); in read() 305 TimeUnit unit, in read() argument 318 read(true, null, bufs, timeout, unit, attachment, handler); in read() 328 TimeUnit unit, in implWrite() argument 337 TimeUnit unit, in write() argument 382 return implWrite(isGatheringWrite, src, srcs, timeout, unit, att, handler); in write() [all …]
|