Home
last modified time | relevance | path

Searched refs:Duration (Results 1 – 25 of 68) sorted by relevance

123

/libcore/ojluni/src/test/java/time/test/java/time/
DTestDuration.java66 import java.time.Duration;
79 assertImmutable(Duration.class); in test_immutable()
84 Duration t = Duration.ofSeconds(-1); in plus_zeroReturnsThis()
85 assertSame(t.plus(Duration.ZERO), t); in plus_zeroReturnsThis()
90 Duration t = Duration.ofSeconds(-1); in plus_zeroSingleton()
91 assertSame(t.plus(Duration.ofSeconds(1)), Duration.ZERO); in plus_zeroSingleton()
96 Duration t = Duration.ofSeconds(-1); in plusSeconds_zeroReturnsThis()
102 Duration t = Duration.ofSeconds(-1); in plusSeconds_zeroSingleton()
103 assertSame(t.plusSeconds(1), Duration.ZERO); in plusSeconds_zeroSingleton()
108 Duration t = Duration.ofSeconds(-1, 2000000); in plusMillis_zeroReturnsThis()
[all …]
DTestZonedDateTime.java64 import java.time.Duration;
92 assertEquals(Duration.between(start, end), Duration.ofHours(17)); in test_duration()
DTestClock_Offset.java66 import java.time.Duration;
78 private static final Duration OFFSET = Duration.ofSeconds(2);
DTestClock_Tick.java66 import java.time.Duration;
86 Clock test = Clock.tick(Clock.system(PARIS), Duration.ofMillis(500)); in test_withZone_same()
93 Clock test = Clock.tick(Clock.systemUTC(), Duration.ofMillis(500)); in test_toString()
/libcore/ojluni/src/test/java/time/tck/java/time/
DTCKDuration.java80 import java.time.Duration;
114 assertEquals(Duration.ZERO.getSeconds(), 0L); in test_zero()
115 assertEquals(Duration.ZERO.getNano(), 0); in test_zero()
124 Duration t = Duration.ofSeconds(i); in factory_seconds_long()
137 Duration t = Duration.ofSeconds(i, j); in factory_seconds_long_long()
142 Duration t = Duration.ofSeconds(i, j); in factory_seconds_long_long()
147 Duration t = Duration.ofSeconds(i, j); in factory_seconds_long_long()
156 Duration test = Duration.ofSeconds(2L, -1); in factory_seconds_long_long_nanosNegativeAdjusted()
163 Duration.ofSeconds(Long.MAX_VALUE, 1000000000); in factory_seconds_long_long_tooBig()
188 Duration test = Duration.ofMillis(millis); in factory_millis_long()
[all …]
DTCKClock_Tick.java66 import java.time.Duration;
88 …t = Clock.tick(Clock.fixed(ZDT.withNano(i * 1000_000).toInstant(), PARIS), Duration.ofMillis(250)); in test_tick_ClockDuration_250millis()
96 …st = Clock.tick(Clock.fixed(ZDT.withNano(i * 1000).toInstant(), PARIS), Duration.ofNanos(250_000)); in test_tick_ClockDuration_250micros()
104 … Clock test = Clock.tick(Clock.fixed(ZDT.withNano(i).toInstant(), PARIS), Duration.ofNanos(20)); in test_tick_ClockDuration_20nanos()
112 Clock test = Clock.tick(underlying, Duration.ZERO); in test_tick_ClockDuration_zeroDuration()
118 Clock test = Clock.tick(underlying, Duration.ofNanos(1)); in test_tick_ClockDuration_1nsDuration()
124 Clock.tick(Clock.systemUTC(), Duration.ofSeconds(Long.MAX_VALUE)); in test_tick_ClockDuration_maxDuration()
129 Clock.tick(Clock.systemUTC(), Duration.ofSeconds(0, 123)); in test_tick_ClockDuration_subMilliNotDivisible_123ns()
134 Clock.tick(Clock.systemUTC(), Duration.ofSeconds(0, 999)); in test_tick_ClockDuration_subMilliNotDivisible_999ns()
139 Clock.tick(Clock.systemUTC(), Duration.ofSeconds(0, 999_999_999)); in test_tick_ClockDuration_subMilliNotDivisible_999_999_999ns()
[all …]
DTCKClock_Offset.java66 import java.time.Duration;
83 private static final Duration OFFSET = Duration.ofSeconds(2);
96 Clock test = Clock.offset(underlying, Duration.ZERO); in test_offset_ClockDuration_zeroDuration()
102 Clock.offset(null, Duration.ZERO); in test_offset_ClockDuration_nullClock()
/libcore/ojluni/src/main/java/java/time/temporal/
DChronoUnit.java59 import java.time.Duration;
83 NANOS("Nanos", Duration.ofNanos(1)),
88 MICROS("Micros", Duration.ofNanos(1000)),
93 MILLIS("Millis", Duration.ofNanos(1000_000)),
99 SECONDS("Seconds", Duration.ofSeconds(1)),
104 MINUTES("Minutes", Duration.ofSeconds(60)),
109 HOURS("Hours", Duration.ofSeconds(3600)),
114 HALF_DAYS("HalfDays", Duration.ofSeconds(43200)),
125 DAYS("Days", Duration.ofSeconds(86400)),
132 WEEKS("Weeks", Duration.ofSeconds(7 * 86400L)),
[all …]
DTemporalUnit.java65 import java.time.Duration;
113 Duration getDuration(); in getDuration()
/libcore/ojluni/annotations/hiddenapi/java/time/
DDuration.java68 public final class Duration class
70 java.lang.Comparable<java.time.Duration>,
73 private Duration(long seconds, int nanos) { in Duration() method in Duration
77 public static java.time.Duration ofDays(long days) { in ofDays()
81 public static java.time.Duration ofHours(long hours) { in ofHours()
85 public static java.time.Duration ofMinutes(long minutes) { in ofMinutes()
89 public static java.time.Duration ofSeconds(long seconds) { in ofSeconds()
93 public static java.time.Duration ofSeconds(long seconds, long nanoAdjustment) { in ofSeconds()
97 public static java.time.Duration ofMillis(long millis) { in ofMillis()
101 public static java.time.Duration ofNanos(long nanos) { in ofNanos()
[all …]
/libcore/luni/src/test/java/libcore/java/time/
DDurationTest.java20 import java.time.Duration;
45 public static final Duration MAX_DURATION = Duration.ofSeconds(Long.MAX_VALUE, 999_999_999);
49 assertSame(Instant.EPOCH, Duration.ZERO.addTo(Instant.EPOCH)); in test_addTo()
54 Duration.between(Instant.EPOCH, Instant.MAX).addTo(Instant.EPOCH)); in test_addTo()
56 Duration.between(Instant.MIN, Instant.MAX).addTo(Instant.MIN)); in test_addTo()
58 Duration.between(Instant.MIN, Instant.EPOCH).addTo(Instant.MIN)); in test_addTo()
63 assertSame(Instant.EPOCH, Duration.ZERO.subtractFrom(Instant.EPOCH)); in test_subtractFrom()
65 Duration.between(Instant.MIN, Instant.EPOCH).subtractFrom(Instant.EPOCH)); in test_subtractFrom()
67 Duration.between(Instant.MIN, Instant.MAX).subtractFrom(Instant.MAX)); in test_subtractFrom()
69 Duration.between(Instant.EPOCH, Instant.MAX).subtractFrom(Instant.MAX)); in test_subtractFrom()
[all …]
DTimeApisConsistencyTest.java30 import java.time.Duration;
89 private static final Set<Duration> INTERESTING_OFFSETS =
90 Set.of(Duration.ZERO, Duration.ofMinutes(30), Duration.ofMinutes(-30),
91 Duration.ofHours(1), Duration.ofHours(-1),
92 Duration.ofHours(2), Duration.ofHours(-2),
93 Duration.ofDays(1), Duration.ofDays(-1));
150 for (Duration interestingOffset : INTERESTING_OFFSETS) { in compareWithBionic()
181 for (Duration interestingOffset : INTERESTING_OFFSETS) { in compareWithJavaUtilTimeZone()
/libcore/ojluni/src/main/java/java/time/
DDuration.java129 public final class Duration class
130 implements TemporalAmount, Comparable<Duration>, Serializable {
135 public static final Duration ZERO = new Duration(0, 0);
175 public static Duration ofDays(long days) { in ofDays()
190 public static Duration ofHours(long hours) { in ofHours()
205 public static Duration ofMinutes(long minutes) { in ofMinutes()
218 public static Duration ofSeconds(long seconds) { in ofSeconds()
241 public static Duration ofSeconds(long seconds, long nanoAdjustment) { in ofSeconds()
256 public static Duration ofMillis(long millis) { in ofMillis()
275 public static Duration ofNanos(long nanos) { in ofNanos()
[all …]
DInstantSource.java150 static InstantSource tick(InstantSource baseSource, Duration tickDuration) { in tick()
193 static InstantSource offset(InstantSource baseSource, Duration offsetDuration) { in offset()
/libcore/luni/src/test/java/libcore/javax/xml/datatype/
DDurationTest.java23 import javax.xml.datatype.Duration;
33 private static final Duration oneSecond = new DurationImpl(1, 0, 0, 0, 0, 0, 1);
34 private static final Duration tenMinutes = new DurationImpl(1, 0, 0, 0, 0, 10, 0);
35 private static final Duration oneDay = new DurationImpl(1, 0, 0, 1, 0 , 0, 0);
36 private static final Duration fiveDays = new DurationImpl(1, 0, 0, 5, 0, 0, 0);
37 private static final Duration twoMonths = new DurationImpl(1, 0, 2, 0, 0, 0, 0);
38 private static final Duration threeYears = new DurationImpl(1, 3, 0, 0, 0, 0, 0);
39 private static final Duration y6m5d4h3m2s1 = new DurationImpl(1, 6, 5, 4, 3, 2, 1);
116 Duration allSet = new DurationImpl(1, 1, 1, 1, 1, 1, 1); in testGetXmlSchemaType()
119 Duration dayHourMinuteSecondSet = new DurationImpl(1, -1, -1, 1, 1, 1, 1); in testGetXmlSchemaType()
[all …]
DDurationImpl.java25 import javax.xml.datatype.Duration;
32 public class DurationImpl extends javax.xml.datatype.Duration {
93 public Duration add(Duration rhs) { in add()
103 public Duration multiply(BigDecimal factor) { in multiply()
108 public Duration negate() { in negate()
113 public Duration normalizeWith(Calendar startTimeInstant) { in normalizeWith()
118 public int compare(Duration duration) { in compare()
DDatatypeFactoryTest.java25 import javax.xml.datatype.Duration;
45 Duration duration = factory.newDuration(true, 1, 2, 3, 4, 5, 6); in testNewDuration_biiiiii()
55 Duration duration = factory.newDurationDayTime(true, 3, 4, 5, 6); in testNewDurationDayTime_biiii()
65 Duration duration = factory.newDuration(true, BigInteger.valueOf(1), BigInteger.valueOf(2), in testNewDurationDayTime_bBigInteger()
87 Duration duration = factory.newDuration(""); in testNewDurationDayTime_String()
122 Duration duration = factory.newDuration(1000L); in testNewDurationDayTime_long()
172 Duration duration = factory.newDurationYearMonth(true, 1, 2); in testNewDurationYearMonth_bii()
182Duration duration = factory.newDurationYearMonth(true, BigInteger.valueOf(1), BigInteger.valueOf(2… in testNewDurationYearMonth_bBigInteger()
192 Duration duration = factory.newDurationYearMonth(""); in testNewDurationYearMonth_String()
224 Duration duration = factory.newDurationYearMonth(1000); in testNewDurationYearMonth_long()
[all …]
/libcore/ojluni/src/test/java/time/tck/java/time/serial/
DTCKDurationSerialization.java70 import java.time.Duration;
81 assertTrue(Serializable.class.isAssignableFrom(Duration.class)); in test_interfaces()
82 assertTrue(Comparable.class.isAssignableFrom(Duration.class)); in test_interfaces()
88 assertSerializable(Duration.ofHours(5)); in test_serialization()
89 assertSerializable(Duration.ofHours(0)); in test_serialization()
90 assertSerializable(Duration.ofHours(-5)); in test_serialization()
102 assertSerializedBySer(Duration.ofSeconds(654321, 123456789), bytes); in test_serialization_format()
110 assertSerializableSame(Duration.ZERO); in test_deserializationSingleton()
115 assertNotSerializable(Duration.class); in test_invalid_serialform()
DTCKClockSerialization.java65 import java.time.Duration;
85 private static final Duration AMOUNT = Duration.ofSeconds(2);
/libcore/ojluni/src/test/java/util/concurrent/tck/
DTimeUnit8Test.java44 import java.time.Duration;
114 assertEquals(n, NANOSECONDS.convert(Duration.ofNanos(n))); in testConvertDuration_roundtripDurationOf()
115 assertEquals(n, NANOSECONDS.convert(Duration.of(n, ChronoUnit.NANOS))); in testConvertDuration_roundtripDurationOf()
116 assertEquals(n, MILLISECONDS.convert(Duration.ofMillis(n))); in testConvertDuration_roundtripDurationOf()
117 assertEquals(n, MILLISECONDS.convert(Duration.of(n, ChronoUnit.MILLIS))); in testConvertDuration_roundtripDurationOf()
118 assertEquals(n, SECONDS.convert(Duration.ofSeconds(n))); in testConvertDuration_roundtripDurationOf()
119 assertEquals(n, SECONDS.convert(Duration.of(n, ChronoUnit.SECONDS))); in testConvertDuration_roundtripDurationOf()
121 assertEquals(n, MINUTES.convert(Duration.ofMinutes(n))); in testConvertDuration_roundtripDurationOf()
122 assertEquals(n, MINUTES.convert(Duration.of(n, ChronoUnit.MINUTES))); in testConvertDuration_roundtripDurationOf()
124 assertEquals(n, HOURS.convert(Duration.ofHours(n))); in testConvertDuration_roundtripDurationOf()
[all …]
/libcore/luni/src/test/java/libcore/java/util/concurrent/
DTestUtils.java21 import java.time.Duration;
41 public static boolean waitWhileTrueOrTimeout(Duration timeout, BooleanSupplier conditionFn) { in waitWhileTrueOrTimeout()
42 Duration startTime = Duration.ofNanos(System.nanoTime()); in waitWhileTrueOrTimeout()
44 Duration now = Duration.ofNanos(System.nanoTime()); in waitWhileTrueOrTimeout()
DRecursiveTaskTest.java22 import java.time.Duration;
51 if(!TestUtils.waitWhileTrueOrTimeout(Duration.ofSeconds(10), in waitForCompletion()
/libcore/luni/src/main/java/javax/xml/datatype/
DDuration.java93 public abstract class Duration { class
487 public abstract Duration add(final Duration rhs); in add()
613 public Duration subtract(final Duration rhs) { in subtract()
633 public Duration multiply(int factor) { in multiply()
684 public abstract Duration multiply(final BigDecimal factor); in multiply()
698 public abstract Duration negate(); in negate()
730 public abstract Duration normalizeWith(final Calendar startTimeInstant); in normalizeWith()
762 public abstract int compare(final Duration duration); in compare()
790 public boolean isLongerThan(final Duration duration) { in isLongerThan()
812 public boolean isShorterThan(final Duration duration) { in isShorterThan()
[all …]
DDatatypeFactory.java167 public abstract Duration newDuration(final String lexicalRepresentation); in newDuration()
204 public abstract Duration newDuration(final long durationInMilliSeconds); in newDuration()
231 public abstract Duration newDuration( in newDuration()
268 public Duration newDuration( in newDuration()
330 public Duration newDurationDayTime(final String lexicalRepresentation) { in newDurationDayTime()
383 public Duration newDurationDayTime(final long durationInMilliseconds) { in newDurationDayTime()
466 public Duration newDurationDayTime( in newDurationDayTime()
508 public Duration newDurationDayTime( in newDurationDayTime()
543 public Duration newDurationYearMonth(final String lexicalRepresentation) { in newDurationYearMonth()
592 public Duration newDurationYearMonth(final long durationInMilliseconds) { in newDurationYearMonth()
[all …]
/libcore/ojluni/src/test/java/time/test/java/time/chrono/
DTestChronologyPerf.java27 import java.time.Duration;
46 Duration d = Duration.of(end - start, ChronoUnit.NANOS); in test_chronologyGetAvailablePerf()
52 d = Duration.of(end - start, ChronoUnit.NANOS); in test_chronologyGetAvailablePerf()
58 d = Duration.of(end - start, ChronoUnit.NANOS); in test_chronologyGetAvailablePerf()

123