/libcore/luni/src/test/java/libcore/java/time/ |
D | DurationTest.java | 21 import java.time.Instant; 49 assertSame(Instant.EPOCH, Duration.ZERO.addTo(Instant.EPOCH)); in test_addTo() 53 assertEquals(Instant.MAX, in test_addTo() 54 Duration.between(Instant.EPOCH, Instant.MAX).addTo(Instant.EPOCH)); in test_addTo() 55 assertEquals(Instant.MAX, in test_addTo() 56 Duration.between(Instant.MIN, Instant.MAX).addTo(Instant.MIN)); in test_addTo() 57 assertEquals(Instant.EPOCH, 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() 64 assertEquals(Instant.MIN, in test_subtractFrom() [all …]
|
D | InstantTest.java | 19 import java.time.Instant; 35 assertEquals(false, Instant.EPOCH.isSupported((TemporalUnit) null)); in test_isSupported_TemporalUnit() 36 assertEquals(true, Instant.EPOCH.isSupported(ChronoUnit.NANOS)); in test_isSupported_TemporalUnit() 37 assertEquals(true, Instant.EPOCH.isSupported(ChronoUnit.MICROS)); in test_isSupported_TemporalUnit() 38 assertEquals(true, Instant.EPOCH.isSupported(ChronoUnit.MILLIS)); in test_isSupported_TemporalUnit() 39 assertEquals(true, Instant.EPOCH.isSupported(ChronoUnit.SECONDS)); in test_isSupported_TemporalUnit() 40 assertEquals(true, Instant.EPOCH.isSupported(ChronoUnit.MINUTES)); in test_isSupported_TemporalUnit() 41 assertEquals(true, Instant.EPOCH.isSupported(ChronoUnit.HOURS)); in test_isSupported_TemporalUnit() 42 assertEquals(true, Instant.EPOCH.isSupported(ChronoUnit.HALF_DAYS)); in test_isSupported_TemporalUnit() 43 assertEquals(true, Instant.EPOCH.isSupported(ChronoUnit.DAYS)); in test_isSupported_TemporalUnit() [all …]
|
/libcore/ojluni/src/test/java/time/tck/java/time/ |
D | TCKInstant.java | 85 import java.time.Instant; 119 private static final long MIN_SECOND = Instant.MIN.getEpochSecond(); 120 private static final long MAX_SECOND = Instant.MAX.getEpochSecond(); 127 private static Instant TEST_12345_123456789; 131 TEST_12345_123456789 = Instant.ofEpochSecond(12345, 123456789); in setUp() 137 TemporalAccessor[] array = {TEST_12345_123456789, Instant.MIN, Instant.MAX, Instant.EPOCH}; in samples() 163 private void check(Instant instant, long epochSecs, int nos) { in check() 173 check(Instant.EPOCH, 0, 0); in constant_EPOCH() 178 check(Instant.MIN, -31557014167219200L, 0); in constant_MIN() 183 check(Instant.MAX, 31556889864403199L, 999_999_999); in constant_MAX() [all …]
|
D | TCKClock.java | 65 import java.time.Instant; 88 public Instant instant() { in instant() 89 return Instant.ofEpochMilli(millis()); in instant() 113 private static final Instant INSTANT = Instant.ofEpochSecond(1873687, 357000000);
|
/libcore/ojluni/src/main/java/java/time/ |
D | Instant.java | 201 public final class Instant class 202 implements Temporal, TemporalAdjuster, Comparable<Instant>, Serializable { 207 public static final Instant EPOCH = new Instant(0, 0); 226 public static final Instant MIN = Instant.ofEpochSecond(MIN_SECOND, 0); 237 public static final Instant MAX = Instant.ofEpochSecond(MAX_SECOND, 999_999_999); 266 public static Instant now() { in now() 281 public static Instant now(Clock clock) { in now() 297 public static Instant ofEpochSecond(long epochSecond) { in ofEpochSecond() 321 public static Instant ofEpochSecond(long epochSecond, long nanoAdjustment) { in ofEpochSecond() 337 public static Instant ofEpochMilli(long epochMilli) { in ofEpochMilli() [all …]
|
D | Clock.java | 314 public static Clock fixed(Instant fixedInstant, ZoneId zone) { in fixed() 410 public abstract Instant instant(); in instant() 470 public Instant instant() { in instant() 471 return Instant.ofEpochMilli(millis()); in instant() 497 private final Instant instant; 500 FixedClock(Instant fixedInstant, ZoneId zone) { in FixedClock() 520 public Instant instant() { in instant() 570 public Instant instant() { in instant() 621 public Instant instant() { in instant() 624 return Instant.ofEpochMilli(millis - Math.floorMod(millis, tickNanos / 1000_000L)); in instant() [all …]
|
D | OffsetDateTime.java | 240 final Instant now = clock.instant(); // called once in now() 317 public static OffsetDateTime ofInstant(Instant instant, ZoneId zone) { in ofInstant() 359 Instant instant = Instant.from(temporal); in from() 906 } else if (adjuster instanceof Instant) { in with() 907 return ofInstant((Instant) adjuster, offset); in with() 965 … case INSTANT_SECONDS: return ofInstant(Instant.ofEpochSecond(newValue, getNano()), offset); in with() 1754 public Instant toInstant() { in toInstant()
|
/libcore/ojluni/src/test/java/time/tck/java/time/format/ |
D | TCKInstantPrinterParser.java | 66 import java.time.Instant; 105 {Instant.MAX.getEpochSecond(), 999999999, "+1000000000-12-31T23:59:59.999999999Z"}, in data_printGrouped() 106 {Instant.MIN.getEpochSecond(), 0, "-1000000000-01-01T00:00:00Z"}, in data_printGrouped() 112 Instant instant = Instant.ofEpochSecond(instantSecs, nano); in test_print_grouped() 183 … {9, Instant.MAX.getEpochSecond(), 999999999, "+1000000000-12-31T23:59:59.999999999Z"}, in data_printDigits() 184 {9, Instant.MIN.getEpochSecond(), 0, "-1000000000-01-01T00:00:00.000000000Z"}, in data_printDigits() 190 Instant instant = Instant.ofEpochSecond(instantSecs, nano); in test_print_digits() 219 {Instant.MAX.getEpochSecond(), 999999999, "+1000000000-12-31T23:59:59.999999999Z"}, in data_parse_digits() 220 {Instant.MIN.getEpochSecond(), 0, "-1000000000-01-01T00:00:00.000000000Z"}, in data_parse_digits() 226 Instant expected = Instant.ofEpochSecond(instantSecs, nano); in test_parse_digitsMinusOne() [all …]
|
/libcore/ojluni/src/test/java/time/test/java/time/ |
D | TestOffsetDateTime_instants.java | 65 import java.time.Instant; 88 OffsetDateTime.ofInstant((Instant) null, OFFSET_PONE); in factory_ofInstant_nullInstant() 93 Instant instant = Instant.ofEpochSecond(0L); in factory_ofInstant_nullOffset() 99 Instant instant = Instant.ofEpochSecond(i); in factory_ofInstant_allSecsInDay() 114 Instant instant = Instant.ofEpochSecond(i * 24L * 60L * 60L); in factory_ofInstant_allDaysInCycle() 135 Instant instant = Instant.ofEpochSecond(days * 24L * 60L * 60L); in factory_ofInstant_tooLow() 148 Instant instant = Instant.ofEpochSecond(days * 24L * 60L * 60L); in factory_ofInstant_tooBig() 157 … Instant instant = Instant.ofEpochSecond(days * 24L * 60L * 60L - OFFSET_MIN.getTotalSeconds()); in factory_ofInstant_minWithMinOffset() 173 … Instant instant = Instant.ofEpochSecond(days * 24L * 60L * 60L - OFFSET_MAX.getTotalSeconds()); in factory_ofInstant_minWithMaxOffset() 189 …Instant instant = Instant.ofEpochSecond((days + 1) * 24L * 60L * 60L - 1 - OFFSET_MIN.getTotalSeco… in factory_ofInstant_maxWithMinOffset() [all …]
|
D | TestInstant.java | 62 import java.time.Instant; 76 assertImmutable(Instant.class); in test_immutable() 94 Instant t1 = Instant.ofEpochMilli(millis); in test_epochMillis()
|
D | TestClock_Fixed.java | 66 import java.time.Instant; 80 …private static final Instant INSTANT = LocalDateTime.of(2008, 6, 30, 11, 30, 10, 500).atZone(ZoneO…
|
/libcore/luni/src/test/java/libcore/java/util/ |
D | DateTest.java | 19 import java.time.Instant; 108 assertEquals(new Date(millis), Date.from(Instant.ofEpochMilli(millis))); in check_convertFromAndToInstant_milliseconds() 109 assertEquals(new Date(millis).toInstant(), Instant.ofEpochMilli(millis)); in check_convertFromAndToInstant_milliseconds() 129 Date.from(Instant.ofEpochSecond(minSecond)); in test_convertFromInstant_secondsAndNanos() 132 Date.from(Instant.ofEpochSecond(minSecond - 1, 192000000)); in test_convertFromInstant_secondsAndNanos() 133 assertArithmeticOverflowDateFrom(Instant.ofEpochSecond(minSecond - 1, 0)); in test_convertFromInstant_secondsAndNanos() 134 assertArithmeticOverflowDateFrom(Instant.ofEpochSecond(minSecond - 1, 191999999)); in test_convertFromInstant_secondsAndNanos() 138 Date.from(Instant.ofEpochSecond(maxSecond, 0)); in test_convertFromInstant_secondsAndNanos() 141 Date.from(Instant.ofEpochSecond(maxSecond, 807999999)); in test_convertFromInstant_secondsAndNanos() 142 assertArithmeticOverflowDateFrom(Instant.ofEpochSecond(maxSecond + 1, 0)); in test_convertFromInstant_secondsAndNanos() [all …]
|
/libcore/luni/src/test/java/libcore/java/time/zone/ |
D | ZoneRulesTest.java | 20 import java.time.Instant; 44 assertNull(zoneRules.nextTransition(Instant.MIN)); in test_of_ZoneOffset() 47 Instant[] instants = new Instant[] { in test_of_ZoneOffset() 49 Instant.EPOCH, in test_of_ZoneOffset() 51 Instant.now(), in test_of_ZoneOffset() 55 for (Instant instant : instants) { in test_of_ZoneOffset()
|
/libcore/ojluni/src/test/java/nio/file/attribute/ |
D | BasicFileAttributeViewCreationTimeTest.java | 40 import java.time.Instant; 71 Instant now = Instant.now(); in test() 101 Instant plusHour = Instant.now().plusSeconds(60L * 60L); in test() 114 Instant minusHour = Instant.now().minusSeconds(60L * 60L); in test()
|
/libcore/ojluni/src/test/java/time/tck/java/time/serial/ |
D | TCKInstantSerialization.java | 68 import java.time.Instant; 79 assertSerializable(Instant.ofEpochMilli(134l)); in test_serialization() 91 assertSerializedBySer(Instant.ofEpochSecond(654321, 123456789), bytes); in test_serialization_format() 96 assertNotSerializable(Instant.class); in test_invalid_serialform()
|
D | TCKClockSerialization.java | 66 import java.time.Instant; 87 private static final Instant INSTANT = ZDT.toInstant();
|
/libcore/ojluni/src/test/java/time/test/java/time/format/ |
D | TestDateTimeParsing.java | 72 import java.time.Instant; 130 {INSTANTSECONDS_WITH_PARIS, "86402", Instant.ofEpochSecond(86402).atZone(PARIS)}, in data_instantZones() 131 …{INSTANTSECONDS_NOS_WITH_PARIS, "86402.123456789", Instant.ofEpochSecond(86402, 123456789).atZone(… in data_instantZones() 132 … {INSTANTSECONDS_OFFSETSECONDS, "86402 9000", Instant.ofEpochSecond(86402).atZone(OFFSET_0230)}, in data_instantZones() 151 assertEquals(Instant.from(actual), expected.toInstant()); in test_parse_instantZones_Instant() 170 {INSTANTSECONDS, "86402", Instant.ofEpochSecond(86402)}, in data_instantNoZone() 171 {INSTANTSECONDS_NOS, "86402.123456789", Instant.ofEpochSecond(86402, 123456789)}, in data_instantNoZone() 176 …public void test_parse_instantNoZone_ZDT(DateTimeFormatter formatter, String text, Instant expecte… in test_parse_instantNoZone_ZDT() 182 …public void test_parse_instantNoZone_LDT(DateTimeFormatter formatter, String text, Instant expecte… in test_parse_instantNoZone_LDT() 188 …public void test_parse_instantNoZone_Instant(DateTimeFormatter formatter, String text, Instant exp… in test_parse_instantNoZone_Instant() [all …]
|
/libcore/luni/src/test/java/libcore/libcore/util/ |
D | ZoneInfoTest.java | 23 import java.time.Instant; 79 private static Instant timeFromSeconds(long timeInSeconds) { in timeFromSeconds() 80 return Instant.ofEpochSecond(timeInSeconds); in timeFromSeconds() 84 boolean[] isDsts, Instant currentTime) { in createZoneInfo()
|
/libcore/luni/src/test/java/libcore/java/time/format/ |
D | DateTimeFormatterTest.java | 20 import java.time.Instant; 78 ZonedDateTime zonedDateTime = Instant.EPOCH.atZone(ZoneId.of("UTC")); in test_format_locale_agq() 86 ZonedDateTime zonedDateTime = Instant.EPOCH.atZone(ZoneId.of("UTC")); in test_format_locale_en_US() 96 private static final Instant TEST_INSTANT = Instant.ofEpochSecond(1640995200L);
|
/libcore/ojluni/src/main/java/java/nio/file/attribute/ |
D | FileTime.java | 28 import java.time.Instant; 67 private Instant instant; 77 private FileTime(long value, TimeUnit unit, Instant instant) { in FileTime() 123 public static FileTime from(Instant instant) { in from() 230 public Instant toInstant() { in toInstant() 267 instant = Instant.MIN; in toInstant() 269 instant = Instant.MAX; in toInstant() 271 instant = Instant.ofEpochSecond(secs, nanos); in toInstant()
|
/libcore/luni/src/test/java/libcore/highmemorytest/java/time/format/ |
D | DateTimeFormatterTest.java | 22 import java.time.Instant; 51 private static final Instant TEST_INSTANT = Instant.ofEpochSecond(1640995200L);
|
/libcore/ojluni/src/test/java/time/test/java/time/zone/ |
D | TestFixedZoneRules.java | 67 import java.time.Instant; 89 assertEquals(test.getOffset((Instant) null), OFFSET_PONE); in test_data_nullInput()
|
/libcore/ojluni/src/main/java/java/time/chrono/ |
D | Chronology.java | 66 import java.time.Instant; 506 Instant instant = Instant.from(temporal); in zonedDateTime() 528 …default ChronoZonedDateTime<? extends ChronoLocalDate> zonedDateTime(Instant instant, ZoneId zone)… in zonedDateTime()
|
/libcore/ojluni/src/main/java/java/time/format/ |
D | DateTimePrintContext.java | 69 import java.time.Instant; 150 return chrono.zonedDateTime(Instant.from(temporal), overrideZone); in adjust() 154 …temporal.get(OFFSET_SECONDS) != overrideZone.getRules().getOffset(Instant.EPOCH).getTotalSeconds()… in adjust()
|
/libcore/luni/src/test/java/libcore/java/time/chrono/ |
D | IsoChronologyTest.java | 20 import java.time.Instant; 119 IsoChronology.INSTANCE.zonedDateTime(Instant.EPOCH, null); in test_zonedDateTime_nullZone()
|