Home
last modified time | relevance | path

Searched refs:instant (Results 1 – 25 of 49) sorted by relevance

12

/libcore/ojluni/src/main/java/java/time/
DClock.java398 return instant().toEpochMilli(); in millis()
410 public abstract Instant instant(); in instant() method in Clock
470 public Instant instant() { in instant() method in Clock.SystemClock
497 private final Instant instant; field in Clock.FixedClock
501 this.instant = fixedInstant; in FixedClock()
513 return new FixedClock(instant, zone); in withZone()
517 return instant.toEpochMilli(); in millis()
520 public Instant instant() { in instant() method in Clock.FixedClock
521 return instant; in instant()
527 return instant.equals(other.instant) && zone.equals(other.zone); in equals()
[all …]
DZonedDateTime.java227 final Instant now = clock.instant(); // called once in now()
400 public static ZonedDateTime ofInstant(Instant instant, ZoneId zone) { in ofInstant() argument
401 Objects.requireNonNull(instant, "instant"); in ofInstant()
403 return create(instant.getEpochSecond(), instant.getNano(), zone); in ofInstant()
448 …Instant instant = Instant.ofEpochSecond(epochSecond, nanoOfSecond); // TODO: rules should be quer… in create() local
449 ZoneOffset offset = rules.getOffset(instant); in create()
1234 Instant instant = (Instant) adjuster; in with() local
1235 return create(instant.getEpochSecond(), instant.getNano(), zone); in with()
DOffsetDateTime.java240 final Instant now = clock.instant(); // called once in now()
317 public static OffsetDateTime ofInstant(Instant instant, ZoneId zone) { in ofInstant() argument
318 Objects.requireNonNull(instant, "instant"); in ofInstant()
321 ZoneOffset offset = rules.getOffset(instant); in ofInstant()
322 …LocalDateTime ldt = LocalDateTime.ofEpochSecond(instant.getEpochSecond(), instant.getNano(), offse… in ofInstant()
359 Instant instant = Instant.from(temporal); in from() local
360 return OffsetDateTime.ofInstant(instant, offset); in from()
DOffsetTime.java194 final Instant now = clock.instant(); // called once in now()
249 public static OffsetTime ofInstant(Instant instant, ZoneId zone) { in ofInstant() argument
250 Objects.requireNonNull(instant, "instant"); in ofInstant()
253 ZoneOffset offset = rules.getOffset(instant); in ofInstant()
254 … long localSecond = instant.getEpochSecond() + offset.getTotalSeconds(); // overflow caught later in ofInstant()
256 LocalTime time = LocalTime.ofNanoOfDay(secsOfDay * NANOS_PER_SECOND + instant.getNano()); in ofInstant()
/libcore/luni/src/test/java/libcore/java/time/zone/
DIcuZoneRulesProviderTest.java88 for (Instant instant : instants) { in testTransitionsNearInstants()
89 ZoneOffset offset = rules.getOffset(instant); in testTransitionsNearInstants()
90 Duration daylightSavings = rules.getDaylightSavings(instant); in testTransitionsNearInstants()
91 timeZone.getOffset(instant.toEpochMilli(), false, icuOffsets); in testTransitionsNearInstants()
93 assertEquals("total offset for " + zoneId + " at " + instant, in testTransitionsNearInstants()
95 assertEquals("dst offset for " + zoneId + " at " + instant, in testTransitionsNearInstants()
101 jtTrans = rules.nextTransition(instant); in testTransitionsNearInstants()
102 icuTrans = timeZone.getNextTransition(instant.toEpochMilli(), false); in testTransitionsNearInstants()
108 jtTrans = rules.previousTransition(instant); in testTransitionsNearInstants()
109 icuTrans = timeZone.getPreviousTransition(instant.toEpochMilli(), false); in testTransitionsNearInstants()
[all …]
DZoneRulesTest.java55 for (Instant instant : instants) { in test_of_ZoneOffset()
56 assertEquals(Duration.ZERO, zoneRules.getDaylightSavings(instant)); in test_of_ZoneOffset()
57 assertEquals(offset, zoneRules.getOffset(instant)); in test_of_ZoneOffset()
58 assertEquals(offset, zoneRules.getStandardOffset(instant)); in test_of_ZoneOffset()
59 LocalDateTime localDateTime = LocalDateTime.ofInstant(instant, offset); in test_of_ZoneOffset()
/libcore/ojluni/src/test/java/time/test/java/time/
DTestOffsetDateTime_instants.java93 Instant instant = Instant.ofEpochSecond(0L); in factory_ofInstant_nullOffset() local
94 OffsetDateTime.ofInstant(instant, (ZoneOffset) null); in factory_ofInstant_nullOffset()
99 Instant instant = Instant.ofEpochSecond(i); in factory_ofInstant_allSecsInDay() local
100 OffsetDateTime test = OffsetDateTime.ofInstant(instant, OFFSET_PONE); in factory_ofInstant_allSecsInDay()
114 Instant instant = Instant.ofEpochSecond(i * 24L * 60L * 60L); in factory_ofInstant_allDaysInCycle() local
115 OffsetDateTime test = OffsetDateTime.ofInstant(instant, ZoneOffset.UTC); in factory_ofInstant_allDaysInCycle()
135 Instant instant = Instant.ofEpochSecond(days * 24L * 60L * 60L); in factory_ofInstant_tooLow() local
136 OffsetDateTime.ofInstant(instant, ZoneOffset.UTC); in factory_ofInstant_tooLow()
148 Instant instant = Instant.ofEpochSecond(days * 24L * 60L * 60L); in factory_ofInstant_tooBig() local
149 OffsetDateTime.ofInstant(instant, ZoneOffset.UTC); in factory_ofInstant_tooBig()
[all …]
/libcore/ojluni/src/main/java/java/nio/file/attribute/
DFileTime.java67 private Instant instant; field in FileTime
77 private FileTime(long value, TimeUnit unit, Instant instant) { in FileTime() argument
80 this.instant = instant; in FileTime()
123 public static FileTime from(Instant instant) { in from() argument
124 Objects.requireNonNull(instant, "instant"); in from()
125 return new FileTime(0, null, instant); in from()
146 long secs = unit.convert(instant.getEpochSecond(), TimeUnit.SECONDS); in to()
150 long nanos = unit.convert(instant.getNano(), TimeUnit.NANOSECONDS); in to()
173 long secs = instant.getEpochSecond(); in toMillis()
174 int nanos = instant.getNano(); in toMillis()
[all …]
/libcore/ojluni/src/test/java/nio/file/attribute/
DFileTimeTest.java128 Instant instant = ft.toInstant(); in main() local
129 if (instant != Instant.MIN && instant != Instant.MAX) { in main()
130 eqTime(value, unit, instant); in main()
137 Instant instant = ft.toInstant(); in main() local
139 eqTime(value, unit, instant); in main()
140 } else if (!instant.equals(Instant.MIN)) { in main()
145 instant = ft.toInstant(); in main()
147 eqTime(value, unit, instant); in main()
148 } else if (!instant.equals(Instant.MAX)) { in main()
158 Instant instant = Instant.ofEpochSecond(secs, rand.nextInt(1000_000_000)); in main() local
[all …]
/libcore/luni/src/test/java/libcore/java/util/
DDateTest.java146 private static void assertArithmeticOverflowDateFrom(Instant instant) { in assertArithmeticOverflowDateFrom() argument
148 Date.from(instant); in assertArithmeticOverflowDateFrom()
149 fail(instant + " should not have been convertible to Date"); in assertArithmeticOverflowDateFrom()
176 Instant instant = date.toInstant(); in check_convertToInstantAndBack() local
177 assertEquals(date, Date.from(instant)); in check_convertToInstantAndBack()
179 assertEquals(instant, Instant.ofEpochMilli(millis)); in check_convertToInstantAndBack()
180 assertEquals("Millis should be a millions of nanos", 0, instant.getNano() % 1000000); in check_convertToInstantAndBack()
183 assertEquals(millis, instant.toEpochMilli()); in check_convertToInstantAndBack()
DCalendarTest.java168 Instant instant = calendar.toInstant(); in testToInstant() local
169 assertEquals(calendar.getTime().toInstant(), instant); in testToInstant() local
170 assertEquals(Instant.ofEpochMilli(calendar.getTimeInMillis()), instant); in testToInstant() local
172 assertEquals(instant, Instant.parse("2007-12-03T09:15:30Z")); in testToInstant()
/libcore/ojluni/src/test/java/time/tck/java/time/
DTCKClock_Tick.java89 assertEquals(test.instant(), ZDT.withNano((i / 250) * 250_000_000).toInstant()); in test_tick_ClockDuration_250millis()
97 assertEquals(test.instant(), ZDT.withNano((i / 250) * 250_000).toInstant()); in test_tick_ClockDuration_250micros()
105 assertEquals(test.instant(), ZDT.withNano((i / 20) * 20).toInstant()); in test_tick_ClockDuration_20nanos()
166 assertEquals(test.instant().getNano(), 0); in test_tickSeconds_ZoneId()
168 assertEquals(test.instant().getNano(), 0); in test_tickSeconds_ZoneId()
180 Instant instant = test.instant(); in test_tickMinutes_ZoneId() local
181 assertEquals(instant.getEpochSecond() % 60, 0); in test_tickMinutes_ZoneId()
182 assertEquals(instant.getNano(), 0); in test_tickMinutes_ZoneId()
DTCKClock.java88 public Instant instant() { in instant() method in TCKClock.MockInstantClock
120 assertEquals(MOCK_INSTANT.instant(), INSTANT); in test_mockInstantClock_get()
129 assertEquals(MOCK_INSTANT.instant(), INSTANT); in test_mockInstantClock_withZone()
DTCKClock_System.java87 Instant instant = system.instant(); in test_instant() local
89 if (systemMillis - instant.toEpochMilli() < 10) { in test_instant()
101 long instant = system.millis(); in test_millis() local
103 if (systemMillis - instant < 10) { in test_millis()
DTCKZonedDateTime.java277 Instant instant = Instant.ofEpochSecond(i).plusNanos(123456789L);
278 Clock clock = Clock.fixed(instant, ZoneOffset.UTC);
296 Instant instant = Instant.ofEpochSecond(i).plusNanos(123456789L);
297 ZonedDateTime expected = ZonedDateTime.ofInstant(instant, zone);
308 Instant instant = Instant.ofEpochSecond(i).plusNanos(123456789L);
309 Clock clock = Clock.fixed(instant, ZoneOffset.UTC);
435 Instant instant = LocalDateTime.of(2008, 6, 30, 11, 30, 10, 35).toInstant(OFFSET_0200);
436 ZonedDateTime test = ZonedDateTime.ofInstant(instant, ZONE_PARIS);
442 Instant instant = LocalDateTime.of(2008, 6, 30, 11, 30, 10, 45).toInstant(OFFSET_0200);
443 ZonedDateTime test = ZonedDateTime.ofInstant(instant, OFFSET_0200);
[all …]
DTCKClock_Fixed.java86 assertEquals(test.instant(), INSTANT); in test_fixed_InstantZoneId()
88 assertEquals(test.instant().getEpochSecond()*1000, test.millis()); in test_fixed_InstantZoneId()
DTCKInstant.java163 private void check(Instant instant, long epochSecs, int nos) { in check() argument
164 assertEquals(instant.getEpochSecond(), epochSecs); in check()
165 assertEquals(instant.getNano(), nos); in check()
166 assertEquals(instant, instant); in check()
167 assertEquals(instant.hashCode(), instant.hashCode()); in check()
1865 Instant instant = Instant.ofEpochSecond(i);
1866 OffsetDateTime test = instant.atOffset(ZoneOffset.ofHours(1));
1887 Instant instant = Instant.ofEpochSecond(i);
1888 ZonedDateTime test = instant.atZone(ZoneOffset.ofHours(1));
2147 public void test_toString(Instant instant, String expected) {
[all …]
/libcore/ojluni/src/main/java/java/time/zone/
DZoneRules.java479 public ZoneOffset getOffset(Instant instant) { in getOffset() argument
483 long epochSec = instant.getEpochSecond(); in getOffset()
750 public ZoneOffset getStandardOffset(Instant instant) { in getStandardOffset() argument
754 long epochSec = instant.getEpochSecond(); in getStandardOffset()
780 public Duration getDaylightSavings(Instant instant) { in getDaylightSavings() argument
784 ZoneOffset standardOffset = getStandardOffset(instant); in getDaylightSavings()
785 ZoneOffset actualOffset = getOffset(instant); in getDaylightSavings()
803 public boolean isDaylightSavings(Instant instant) { in isDaylightSavings() argument
804 return (getStandardOffset(instant).equals(getOffset(instant)) == false); in isDaylightSavings()
836 public ZoneOffsetTransition nextTransition(Instant instant) { in nextTransition() argument
[all …]
/libcore/ojluni/src/main/java/java/time/chrono/
DChronoZonedDateTimeImpl.java170 static ChronoZonedDateTimeImpl<?> ofInstant(Chronology chrono, Instant instant, ZoneId zone) { in ofInstant() argument
172 ZoneOffset offset = rules.getOffset(instant); in ofInstant()
174 …LocalDateTime ldt = LocalDateTime.ofEpochSecond(instant.getEpochSecond(), instant.getNano(), offse… in ofInstant()
187 private ChronoZonedDateTimeImpl<D> create(Instant instant, ZoneId zone) { in create() argument
188 return (ChronoZonedDateTimeImpl<D>)ofInstant(getChronology(), instant, zone); in create()
DChronology.java506 Instant instant = Instant.from(temporal); in zonedDateTime() local
507 return zonedDateTime(instant, zone); in zonedDateTime()
528 …default ChronoZonedDateTime<? extends ChronoLocalDate> zonedDateTime(Instant instant, ZoneId zone)… in zonedDateTime() argument
529 return ChronoZonedDateTimeImpl.ofInstant(this, instant, zone); in zonedDateTime()
DMinguoChronology.java274 public ChronoZonedDateTime<MinguoDate> zonedDateTime(Instant instant, ZoneId zone) { in zonedDateTime() argument
275 return (ChronoZonedDateTime<MinguoDate>)super.zonedDateTime(instant, zone); in zonedDateTime()
/libcore/ojluni/src/test/java/time/tck/java/time/format/
DTCKInstantPrinterParser.java112 Instant instant = Instant.ofEpochSecond(instantSecs, nano); in test_print_grouped() local
114 assertEquals(f.format(instant), expected); in test_print_grouped()
190 Instant instant = Instant.ofEpochSecond(instantSecs, nano); in test_print_digits() local
192 assertEquals(f.format(instant), expected); in test_print_digits()
/libcore/ojluni/src/test/java/time/tck/java/time/zone/
DTCKZoneRules.java123 Instant instant = old.toInstant(); in test_London_preTimeZones() local
125 assertEquals(test.getOffset(instant), offset); in test_London_preTimeZones()
127 assertEquals(test.getStandardOffset(instant), offset); in test_London_preTimeZones()
128 assertEquals(test.getDaylightSavings(instant), Duration.ZERO); in test_London_preTimeZones()
129 assertEquals(test.isDaylightSavings(instant), false); in test_London_preTimeZones()
279 Instant instant = zdt.toInstant(); in test_London_getStandardOffset() local
281 … assertEquals(test.getStandardOffset(instant), ZoneOffset.ofHoursMinutesSeconds(0, -1, -15)); in test_London_getStandardOffset()
283 assertEquals(test.getStandardOffset(instant), OFFSET_PONE); in test_London_getStandardOffset()
285 assertEquals(test.getStandardOffset(instant), OFFSET_ZERO); in test_London_getStandardOffset()
505 Instant instant = old.toInstant(); in test_Paris_preTimeZones() local
[all …]
/libcore/ojluni/src/test/java/time/test/java/util/
DTestFormatter.java108 Instant instant = zdt.toInstant(); in test() local
118 cal.setTimeInMillis(instant.toEpochMilli()); in test()
127 testInstant(locale, instant, zdt, cal); in test()
243 private void testInstant(Locale locale, Instant instant, in testInstant() argument
248 test(fmtStr, locale, expected, instant); in testInstant()
/libcore/ojluni/src/main/java/java/time/format/
DParsed.java343 Instant instant = Instant.ofEpochSecond(fieldValues.remove(INSTANT_SECONDS)); in resolveInstantFields0() local
344 ChronoZonedDateTime<?> zdt = chrono.zonedDateTime(instant, selectedZone); in resolveInstantFields0()
590 long instant = date.atTime(time).atZone(zone).getLong(ChronoField.INSTANT_SECONDS); in resolveInstant() local
591 fieldValues.put(INSTANT_SECONDS, instant); in resolveInstant()
596 … long instant = date.atTime(time).atZone(offset).getLong(ChronoField.INSTANT_SECONDS); in resolveInstant() local
597 fieldValues.put(INSTANT_SECONDS, instant); in resolveInstant()

12