Home
last modified time | relevance | path

Searched refs:ZoneOffset (Results 1 – 25 of 102) sorted by relevance

12345

/libcore/ojluni/src/test/java/time/test/java/time/format/
DTestZoneOffsetPrinter.java65 import java.time.ZoneOffset;
76 private static final ZoneOffset OFFSET_0130 = ZoneOffset.of("+01:30");
82 {"+HH", "NO-OFFSET", ZoneOffset.UTC}, in provider_offsets()
83 {"+HH", "+01", ZoneOffset.ofHours(1)}, in provider_offsets()
84 {"+HH", "-01", ZoneOffset.ofHours(-1)}, in provider_offsets()
86 {"+HHMM", "NO-OFFSET", ZoneOffset.UTC}, in provider_offsets()
87 {"+HHMM", "+0102", ZoneOffset.ofHoursMinutes(1, 2)}, in provider_offsets()
88 {"+HHMM", "-0102", ZoneOffset.ofHoursMinutes(-1, -2)}, in provider_offsets()
90 {"+HH:MM", "NO-OFFSET", ZoneOffset.UTC}, in provider_offsets()
91 {"+HH:MM", "+01:02", ZoneOffset.ofHoursMinutes(1, 2)}, in provider_offsets()
[all …]
DTestZoneOffsetParser.java67 import java.time.ZoneOffset;
102 assertParsed(parsed, ZoneOffset.UTC); in test_parse_exactMatch_UTC()
109 assertParsed(parsed, ZoneOffset.UTC); in test_parse_startStringMatch_UTC()
116 assertParsed(parsed, ZoneOffset.UTC); in test_parse_midStringMatch_UTC()
123 assertParsed(parsed, ZoneOffset.UTC); in test_parse_endStringMatch_UTC()
131 assertParsed(parsed, ZoneOffset.UTC); in test_parse_exactMatch_UTC_EmptyUTC()
138 assertParsed(parsed, ZoneOffset.UTC); in test_parse_startStringMatch_UTC_EmptyUTC()
145 assertParsed(parsed, ZoneOffset.UTC); in test_parse_midStringMatch_UTC_EmptyUTC()
152 assertParsed(parsed, ZoneOffset.UTC); in test_parse_endStringMatch_UTC_EmptyUTC()
159 {"+HH", "+00", ZoneOffset.UTC}, in provider_offsets()
[all …]
/libcore/ojluni/src/test/java/time/test/java/time/
DTestZoneId.java73 import java.time.ZoneOffset;
116 ZoneId test = ZoneOffset.UTC; in test_constant_UTC()
120 assertEquals(test.getRules().getOffset(Instant.ofEpochSecond(0L)), ZoneOffset.UTC); in test_constant_UTC()
121 checkOffset(test.getRules(), createLDT(2008, 6, 30), ZoneOffset.UTC, 1); in test_constant_UTC()
165 …ertEquals(test.getRules().getOffset(createInstant(2008, 1, 1, ZoneOffset.UTC)), ZoneOffset.ofHours… in test_London_getOffset()
166 …ertEquals(test.getRules().getOffset(createInstant(2008, 2, 1, ZoneOffset.UTC)), ZoneOffset.ofHours… in test_London_getOffset()
167 …ertEquals(test.getRules().getOffset(createInstant(2008, 3, 1, ZoneOffset.UTC)), ZoneOffset.ofHours… in test_London_getOffset()
168 …ertEquals(test.getRules().getOffset(createInstant(2008, 4, 1, ZoneOffset.UTC)), ZoneOffset.ofHours… in test_London_getOffset()
169 …ertEquals(test.getRules().getOffset(createInstant(2008, 5, 1, ZoneOffset.UTC)), ZoneOffset.ofHours… in test_London_getOffset()
170 …ertEquals(test.getRules().getOffset(createInstant(2008, 6, 1, ZoneOffset.UTC)), ZoneOffset.ofHours… in test_London_getOffset()
[all …]
DTestOffsetDateTime_instants.java71 import java.time.ZoneOffset;
81 private static final ZoneOffset OFFSET_PONE = ZoneOffset.ofHours(1);
82 private static final ZoneOffset OFFSET_MAX = ZoneOffset.ofHours(18);
83 private static final ZoneOffset OFFSET_MIN = ZoneOffset.ofHours(-18);
94 OffsetDateTime.ofInstant(instant, (ZoneOffset) null); in factory_ofInstant_nullOffset()
112 …e expected = OffsetDateTime.of(LocalDate.of(1970, 1, 1), LocalTime.of(0, 0, 0, 0), ZoneOffset.UTC); in factory_ofInstant_allDaysInCycle()
115 OffsetDateTime test = OffsetDateTime.ofInstant(instant, ZoneOffset.UTC); in factory_ofInstant_allDaysInCycle()
136 OffsetDateTime.ofInstant(instant, ZoneOffset.UTC); in factory_ofInstant_tooLow()
149 OffsetDateTime.ofInstant(instant, ZoneOffset.UTC); in factory_ofInstant_tooBig()
239 …d = OffsetDateTime.of(LocalDate.of((int) minYear, 1, 1), LocalTime.of(0, 0, 0, 0), ZoneOffset.UTC); in doTest_factory_ofInstant_all()
[all …]
DTestZoneOffset.java64 import java.time.ZoneOffset;
76 assertImmutable(ZoneOffset.class); in test_immutable()
81 assertSame(ZoneOffset.ofTotalSeconds(0), ZoneOffset.UTC); in test_factory_ofTotalSecondsSame()
/libcore/ojluni/src/test/java/time/tck/java/time/
DTCKZoneOffset.java77 import java.time.ZoneOffset;
102 …TemporalAccessor[] array = {ZoneOffset.ofHours(1), ZoneOffset.ofHoursMinutesSeconds(-5, -6, -30) }; in samples()
129 ZoneOffset test = ZoneOffset.UTC; in test_constant_UTC()
135 ZoneOffset test = ZoneOffset.MIN; in test_constant_MIN()
141 ZoneOffset test = ZoneOffset.MAX; in test_constant_MAX()
156 ZoneOffset test = ZoneOffset.of(values[i]); in test_factory_string_UTC()
157 assertSame(test, ZoneOffset.UTC); in test_factory_string_UTC()
180 ZoneOffset.of(values[i]); in test_factory_string_invalid()
190 ZoneOffset.of((String) null); in test_factory_string_null()
198 ZoneOffset test = ZoneOffset.of(str); in test_factory_string_singleDigitHours()
[all …]
DTCKZoneId.java75 import java.time.ZoneOffset;
233 assertEquals(test, ZoneOffset.of(id)); in factory_of_String_offsetBasedValid_noPrefix()
234 assertEquals(test.normalized(), ZoneOffset.of(id)); in factory_of_String_offsetBasedValid_noPrefix()
237 assertEquals(test.getRules().getOffset(Instant.EPOCH), ZoneOffset.of(id)); in factory_of_String_offsetBasedValid_noPrefix()
281 assertEquals(test.getRules(), ZoneOffset.of(offsetId).getRules()); in factory_of_String_offsetBasedValid_prefixUTC()
282 assertEquals(test.normalized(), ZoneOffset.of(offsetId)); in factory_of_String_offsetBasedValid_prefixUTC()
285 assertEquals(test.getRules().getOffset(Instant.EPOCH), ZoneOffset.of(offsetId)); in factory_of_String_offsetBasedValid_prefixUTC()
292 assertEquals(test.getRules(), ZoneOffset.of(offsetId).getRules()); in factory_of_String_offsetBasedValid_prefixGMT()
293 assertEquals(test.normalized(), ZoneOffset.of(offsetId)); in factory_of_String_offsetBasedValid_prefixGMT()
296 assertEquals(test.getRules().getOffset(Instant.EPOCH), ZoneOffset.of(offsetId)); in factory_of_String_offsetBasedValid_prefixGMT()
[all …]
DTCKClock_Fixed.java69 import java.time.ZoneOffset;
81 …nstant INSTANT = LocalDateTime.of(2008, 6, 30, 11, 30, 10, 500).atZone(ZoneOffset.ofHours(2)).toIn…
122 Clock a = Clock.fixed(INSTANT, ZoneOffset.UTC); in test_equals()
123 Clock b = Clock.fixed(INSTANT, ZoneOffset.UTC); in test_equals()
132 Clock d = Clock.fixed(INSTANT.minusNanos(1), ZoneOffset.UTC); in test_equals()
141 Clock a = Clock.fixed(INSTANT, ZoneOffset.UTC); in test_hashCode()
142 Clock b = Clock.fixed(INSTANT, ZoneOffset.UTC); in test_hashCode()
149 Clock d = Clock.fixed(INSTANT.minusNanos(1), ZoneOffset.UTC); in test_hashCode()
/libcore/ojluni/src/test/java/time/tck/java/time/zone/
DTCKZoneRules.java81 import java.time.ZoneOffset;
99 private static final ZoneOffset OFFSET_ZERO = ZoneOffset.ofHours(0);
100 private static final ZoneOffset OFFSET_PONE = ZoneOffset.ofHours(1);
101 private static final ZoneOffset OFFSET_PTWO = ZoneOffset.ofHours(2);
122 ZonedDateTime old = createZDT(1800, 1, 1, ZoneOffset.UTC); in test_London_preTimeZones()
124 ZoneOffset offset = ZoneOffset.ofHoursMinutesSeconds(0, -1, -15); in test_London_preTimeZones()
134 assertEquals(test.getOffset(createInstant(2008, 1, 1, ZoneOffset.UTC)), OFFSET_ZERO); in test_London_getOffset()
135 assertEquals(test.getOffset(createInstant(2008, 2, 1, ZoneOffset.UTC)), OFFSET_ZERO); in test_London_getOffset()
136 assertEquals(test.getOffset(createInstant(2008, 3, 1, ZoneOffset.UTC)), OFFSET_ZERO); in test_London_getOffset()
137 assertEquals(test.getOffset(createInstant(2008, 4, 1, ZoneOffset.UTC)), OFFSET_PONE); in test_London_getOffset()
[all …]
DTCKFixedZoneRules.java73 import java.time.ZoneOffset;
88 private static final ZoneOffset OFFSET_PONE = ZoneOffset.ofHours(1);
89 private static final ZoneOffset OFFSET_PTWO = ZoneOffset.ofHours(2);
90 private static final ZoneOffset OFFSET_M18 = ZoneOffset.ofHours(-18);
94 private ZoneRules make(ZoneOffset offset) { in make()
112 public void test_getOffset_Instant(ZoneRules test, ZoneOffset expectedOffset) { in test_getOffset_Instant()
118 public void test_getOffset_LocalDateTime(ZoneRules test, ZoneOffset expectedOffset) { in test_getOffset_LocalDateTime()
124 public void test_getValidOffsets_LDT(ZoneRules test, ZoneOffset expectedOffset) { in test_getValidOffsets_LDT()
132 public void test_getTransition_LDT(ZoneRules test, ZoneOffset expectedOffset) { in test_getTransition_LDT()
138 public void test_isValidOffset_LDT_ZO(ZoneRules test, ZoneOffset expectedOffset) { in test_isValidOffset_LDT_ZO()
[all …]
/libcore/ojluni/src/main/java/java/time/
DZoneOffset.java124 public final class ZoneOffset class
126 implements TemporalAccessor, TemporalAdjuster, Comparable<ZoneOffset>, Serializable {
129 …private static final ConcurrentMap<Integer, ZoneOffset> SECONDS_CACHE = new ConcurrentHashMap<>(16…
131 …private static final ConcurrentMap<String, ZoneOffset> ID_CACHE = new ConcurrentHashMap<>(16, 0.75…
145 public static final ZoneOffset UTC = ZoneOffset.ofTotalSeconds(0);
149 public static final ZoneOffset MIN = ZoneOffset.ofTotalSeconds(-MAX_SECONDS);
153 public static final ZoneOffset MAX = ZoneOffset.ofTotalSeconds(MAX_SECONDS);
196 public static ZoneOffset of(String offsetId) { in of()
199 ZoneOffset offset = ID_CACHE.get(offsetId); in of()
276 public static ZoneOffset ofHours(int hours) { in ofHours()
[all …]
/libcore/ojluni/src/main/java/java/time/zone/
DZoneOffsetTransitionRule.java78 import java.time.ZoneOffset;
140 private final ZoneOffset standardOffset;
144 private final ZoneOffset offsetBefore;
148 private final ZoneOffset offsetAfter;
178 ZoneOffset standardOffset, in of()
179 ZoneOffset offsetBefore, in of()
180 ZoneOffset offsetAfter) { in of()
220 ZoneOffset standardOffset, in ZoneOffsetTransitionRule()
221 ZoneOffset offsetBefore, in ZoneOffsetTransitionRule()
222 ZoneOffset offsetAfter) { in ZoneOffsetTransitionRule()
[all …]
DZoneOffsetTransition.java73 import java.time.ZoneOffset;
113 private final ZoneOffset offsetBefore;
117 private final ZoneOffset offsetAfter;
134 …c static ZoneOffsetTransition of(LocalDateTime transition, ZoneOffset offsetBefore, ZoneOffset off… in of()
154 … ZoneOffsetTransition(LocalDateTime transition, ZoneOffset offsetBefore, ZoneOffset offsetAfter) { in ZoneOffsetTransition()
167 ZoneOffsetTransition(long epochSecond, ZoneOffset offsetBefore, ZoneOffset offsetAfter) { in ZoneOffsetTransition()
226 ZoneOffset before = Ser.readOffset(in); in readExternal()
227 ZoneOffset after = Ser.readOffset(in); in readExternal()
297 public ZoneOffset getOffsetBefore() { in getOffsetBefore()
308 public ZoneOffset getOffsetAfter() { in getOffsetAfter()
[all …]
DZoneRules.java75 import java.time.ZoneOffset;
128 private final ZoneOffset[] standardOffsets;
142 private final ZoneOffset[] wallOffsets;
176 public static ZoneRules of(ZoneOffset baseStandardOffset, in of()
177 ZoneOffset baseWallOffset, in of()
197 public static ZoneRules of(ZoneOffset offset) { in of()
211 ZoneRules(ZoneOffset baseStandardOffset, in ZoneRules()
212 ZoneOffset baseWallOffset, in ZoneRules()
222 this.standardOffsets = new ZoneOffset[standardOffsetTransitionList.size() + 1]; in ZoneRules()
231 List<ZoneOffset> localTransitionOffsetList = new ArrayList<>(); in ZoneRules()
[all …]
/libcore/luni/src/test/java/libcore/java/time/
DOffsetDateTimeTest.java20 import java.time.ZoneOffset;
35 OffsetDateTime.of(2000, 1, 2, 3, 4, 5, 6, ZoneOffset.UTC);
43 assertEquals(OffsetDateTime.of(2000, 1, 2, 4, 4, 5, 6, ZoneOffset.UTC), in test_plus()
45 assertEquals(OffsetDateTime.of(2000, 1, 3, 2, 4, 5, 6, ZoneOffset.UTC), in test_plus()
47 assertEquals(OffsetDateTime.of(2000, 1, 2, 3, 5, 5, 6, ZoneOffset.UTC), in test_plus()
49 assertEquals(OffsetDateTime.of(2000, 1, 2, 3, 5, 5, 6, ZoneOffset.UTC), in test_plus()
51 assertEquals(OffsetDateTime.of(2000, 1, 2, 3, 4, 5, 1_000_006, ZoneOffset.UTC), in test_plus()
53 assertEquals(OffsetDateTime.of(2000, 1, 2, 3, 4, 5, 7, ZoneOffset.UTC), in test_plus()
DOffsetTimeTest.java20 import java.time.ZoneOffset;
39 .of(/* hour */ 12, /* minute */ 0, /* second */ 0, /* nano */ 0, ZoneOffset.UTC);
45 assertEquals(OffsetTime.of(13, 0, 0, 0, ZoneOffset.UTC), in test_plus()
47 assertEquals(OffsetTime.of(11, 0, 0, 0, ZoneOffset.UTC), in test_plus()
49 assertEquals(OffsetTime.of(12, 1, 0, 0, ZoneOffset.UTC), in test_plus()
51 assertEquals(OffsetTime.of(12, 1, 0, 0, ZoneOffset.UTC), in test_plus()
53 assertEquals(OffsetTime.of(12, 0, 0, 1_000_000, ZoneOffset.UTC), in test_plus()
55 assertEquals(OffsetTime.of(12, 0, 0, 1, ZoneOffset.UTC), in test_plus()
DZonedDateTimeTest.java24 import java.time.ZoneOffset;
42 private static final ZoneOffset OFFSET_P1 = ZoneOffset.ofHours(1);
45 private static final ZoneOffset OFFSET_P2 = ZoneOffset.ofHours(2);
80 checkOfInstant(LDT_P1, ZoneOffset.ofHours(-10), ZONE_VIENNA, LDT_P1.withHour(11), in test_ofInstant()
98 private static void checkOfInstant(LocalDateTime localDateTime, ZoneOffset offset, in checkOfInstant()
99 ZoneId zone, LocalDateTime expectedDateTime, ZoneOffset expectedOffset) { in checkOfInstant()
145 checkOfLocal(LDT_P1, ZONE_VIENNA, ZoneOffset.ofHours(-10), LDT_P1, OFFSET_P1); in test_ofLocal()
159 checkOfLocal(LDT_IN_OVERLAP, ZONE_VIENNA, ZoneOffset.ofHours(10), in test_ofLocal()
169 ZoneOffset preferredOffset, LocalDateTime expectedDateTime, ZoneOffset expectedOffset) { in checkOfLocal()
/libcore/ojluni/src/test/java/time/tck/java/time/zone/serial/
DTCKFixedZoneRulesSerialization.java69 import java.time.ZoneOffset;
80 private static final ZoneOffset OFFSET_PONE = ZoneOffset.ofHours(1);
81 private static final ZoneOffset OFFSET_PTWO = ZoneOffset.ofHours(2);
82 private static final ZoneOffset OFFSET_M18 = ZoneOffset.ofHours(-18);
84 private ZoneRules make(ZoneOffset offset) { in make()
101 public void test_serialization(ZoneRules test, ZoneOffset expectedOffset) throws Exception { in test_serialization()
DTCKZoneOffsetTransitionSerialization.java70 import java.time.ZoneOffset;
79 private static final ZoneOffset OFFSET_0200 = ZoneOffset.ofHours(2);
80 private static final ZoneOffset OFFSET_0300 = ZoneOffset.ofHours(3);
86 …ZoneOffsetTransition test = ZoneOffsetTransition.of(ldt, ZoneOffset.of("+02:04:56"), ZoneOffset.of… in test_serialization_unusual1()
93 …ZoneOffsetTransition test = ZoneOffsetTransition.of(ldt, ZoneOffset.of("+02:04:56"), ZoneOffset.of… in test_serialization_unusual2()
DTCKZoneOffsetTransitionRuleSerialization.java65 import java.time.ZoneOffset;
79 private static final ZoneOffset OFFSET_0200 = ZoneOffset.ofHours(2);
80 private static final ZoneOffset OFFSET_0300 = ZoneOffset.ofHours(3);
90 ZoneOffset.ofHoursMinutesSeconds(-12, -20, -50), in test_serialization_unusualOffsets()
91 ZoneOffset.ofHoursMinutesSeconds(-4, -10, -34), in test_serialization_unusualOffsets()
92 ZoneOffset.ofHours(-18)); in test_serialization_unusualOffsets()
/libcore/ojluni/src/test/java/time/tck/java/time/format/
DTCKOffsetPrinterParser.java67 import java.time.ZoneOffset;
83 private static final ZoneOffset OFFSET_UTC = ZoneOffset.UTC;
84 private static final ZoneOffset OFFSET_P0100 = ZoneOffset.ofHours(1);
85 private static final ZoneOffset OFFSET_P0123 = ZoneOffset.ofHoursMinutes(1, 23);
86 private static final ZoneOffset OFFSET_P0023 = ZoneOffset.ofHoursMinutes(0, 23);
87 private static final ZoneOffset OFFSET_P012345 = ZoneOffset.ofHoursMinutesSeconds(1, 23, 45);
88 private static final ZoneOffset OFFSET_P000045 = ZoneOffset.ofHoursMinutesSeconds(0, 0, 45);
89 private static final ZoneOffset OFFSET_M0100 = ZoneOffset.ofHours(-1);
90 private static final ZoneOffset OFFSET_M0123 = ZoneOffset.ofHoursMinutes(-1, -23);
91 private static final ZoneOffset OFFSET_M0023 = ZoneOffset.ofHoursMinutes(0, -23);
[all …]
/libcore/luni/src/test/java/libcore/java/time/zone/
DZoneOffsetTransitionTest.java22 import java.time.ZoneOffset;
37 ZoneOffset offsetP1 = ZoneOffset.ofHours(1); in test_toEpochSeconds()
38 ZoneOffset offsetP2 = ZoneOffset.ofHours(2); in test_toEpochSeconds()
DIcuZoneRulesProviderTest.java29 import java.time.ZoneOffset;
70 LocalDateTime.of(1900, Month.DECEMBER, 24, 12, 0).toInstant(ZoneOffset.UTC), in testTransitionsNearInstants()
71 LocalDateTime.of(1970, Month.JANUARY, 1, 2, 3).toInstant(ZoneOffset.UTC), in testTransitionsNearInstants()
72 LocalDateTime.of(1980, Month.FEBRUARY, 4, 5, 6).toInstant(ZoneOffset.UTC), in testTransitionsNearInstants()
73 LocalDateTime.of(1990, Month.MARCH, 7, 8, 9).toInstant(ZoneOffset.UTC), in testTransitionsNearInstants()
74 LocalDateTime.of(2000, Month.APRIL, 10, 11, 12).toInstant(ZoneOffset.UTC), in testTransitionsNearInstants()
75 LocalDateTime.of(2016, Month.MAY, 13, 14, 15).toInstant(ZoneOffset.UTC), in testTransitionsNearInstants()
76 LocalDateTime.of(2020, Month.JUNE, 16, 17, 18).toInstant(ZoneOffset.UTC), in testTransitionsNearInstants()
77 LocalDateTime.of(2100, Month.JULY, 19, 20, 21).toInstant(ZoneOffset.UTC), in testTransitionsNearInstants()
89 ZoneOffset offset = rules.getOffset(instant); in testTransitionsNearInstants()
[all …]
/libcore/ojluni/src/test/java/time/tck/java/time/serial/
DTCKZoneOffsetSerialization.java67 import java.time.ZoneOffset;
80 assertSerializable(ZoneOffset.of("+01:30")); in test_serialization()
91 assertSerializedBySer(ZoneOffset.ofHoursMinutes(1, 30), bytes); in test_serialization_format_quarterPositive()
102 assertSerializedBySer(ZoneOffset.ofHoursMinutes(-2, -30), bytes); in test_serialization_format_quarterNegative()
114 assertSerializedBySer(ZoneOffset.ofTotalSeconds(53265), bytes); in test_serialization_format_full()
119 assertNotSerializable(ZoneOffset.class); in test_invalid_serialform()
/libcore/ojluni/src/main/java/java/time/chrono/
DChronoZonedDateTimeImpl.java75 import java.time.ZoneOffset;
119 private final transient ZoneOffset offset;
135 ChronoLocalDateTimeImpl<R> localDateTime, ZoneId zone, ZoneOffset preferredOffset) { in ofBest()
138 if (zone instanceof ZoneOffset) { in ofBest()
139 return new ChronoZonedDateTimeImpl<>(localDateTime, (ZoneOffset) zone, zone); in ofBest()
143 List<ZoneOffset> validOffsets = rules.getValidOffsets(isoLDT); in ofBest()
144 ZoneOffset offset; in ofBest()
172 ZoneOffset offset = rules.getOffset(instant); in ofInstant()
218 …private ChronoZonedDateTimeImpl(ChronoLocalDateTimeImpl<D> dateTime, ZoneOffset offset, ZoneId zon… in ChronoZonedDateTimeImpl()
226 public ZoneOffset getOffset() { in getOffset()
[all …]

12345