下面列出了java.time.chrono.Era#java.time.OffsetDateTime 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
@DataProvider(name="adjustInto")
Object[][] data_adjustInto() {
return new Object[][]{
{OffsetTime.of(LocalTime.of(23, 5), OFFSET_PONE), OffsetTime.of(LocalTime.of(1, 1, 1, 100), ZoneOffset.UTC), OffsetTime.of(LocalTime.of(23, 5), OFFSET_PONE), null},
{OffsetTime.of(LocalTime.of(23, 5), OFFSET_PONE), OffsetTime.MAX, OffsetTime.of(LocalTime.of(23, 5), OFFSET_PONE), null},
{OffsetTime.of(LocalTime.of(23, 5), OFFSET_PONE), OffsetTime.MIN, OffsetTime.of(LocalTime.of(23 , 5), OFFSET_PONE), null},
{OffsetTime.MAX, OffsetTime.of(LocalTime.of(23, 5), OFFSET_PONE), OffsetTime.of(OffsetTime.MAX.toLocalTime(), ZoneOffset.ofHours(-18)), null},
{OffsetTime.MIN, OffsetTime.of(LocalTime.of(23, 5), OFFSET_PONE), OffsetTime.of(OffsetTime.MIN.toLocalTime(), ZoneOffset.ofHours(18)), null},
{OffsetTime.of(LocalTime.of(23, 5), OFFSET_PONE), ZonedDateTime.of(LocalDateTime.of(2012, 3, 4, 1, 1, 1, 100), ZONE_GAZA), ZonedDateTime.of(LocalDateTime.of(2012, 3, 4, 23, 5), ZONE_GAZA), null},
{OffsetTime.of(LocalTime.of(23, 5), OFFSET_PONE), OffsetDateTime.of(LocalDateTime.of(2012, 3, 4, 1, 1, 1, 100), ZoneOffset.UTC), OffsetDateTime.of(LocalDateTime.of(2012, 3, 4, 23, 5), OFFSET_PONE), null},
{OffsetTime.of(LocalTime.of(23, 5), OFFSET_PONE), LocalDateTime.of(2012, 3, 4, 1, 1, 1, 100), null, DateTimeException.class},
{OffsetTime.of(LocalTime.of(23, 5), OFFSET_PONE), LocalDate.of(2210, 2, 2), null, DateTimeException.class},
{OffsetTime.of(LocalTime.of(23, 5), OFFSET_PONE), LocalTime.of(22, 3, 0), null, DateTimeException.class},
{OffsetTime.of(LocalTime.of(23, 5), OFFSET_PONE), null, null, NullPointerException.class},
};
}
@Test
public void runTypical() throws Exception {
when(offsetManager.getLatestOffsets(TOPIC_NAME)).thenReturn(ImmutableMap.of(1, 10L, 2, 20L));
when(offsetManager.getCommittedOffsets(TOPIC_NAME)).thenReturn(ImmutableMap.of(1, 5L, 2, 15L));
when(landerFactory.newInstance(expectedLanderConfiguration)).thenReturn(lander);
CompletableFuture<LanderConfiguration> future = new CompletableFuture<>();
when(lander.run()).thenReturn(future);
future.complete(expectedLanderConfiguration);
when(hivePartitionManager.addPartition(eq(ROAD_NAME), any(), any())).thenReturn(Optional.of(partition));
underTest.run(OffsetDateTime.ofInstant(Instant.ofEpochMilli(runtimeMillis), ZoneOffset.UTC));
verify(offsetManager).getCommittedOffsets(TOPIC_NAME);
verify(offsetManager).getLatestOffsets(TOPIC_NAME);
verify(landerFactory).newInstance(expectedLanderConfiguration);
verify(hivePartitionManager).addPartition(ROAD_NAME, singletonList(ACQUISITION_INSTANT), S3_PREFIX);
verify(offsetManager).commitOffsets(TOPIC_NAME, ImmutableMap.of(1, 10L, 2, 20L));
verify(landingNotifier).handlePartitionCreated(ROAD_NAME, partition, PARTITION_SPEC, 10L);
verify(emitter)
.emit(new PatchSet(ROAD_NAME, singletonList(PatchOperation.replace(LAST_RUN_PATH, "2018-05-16T09:17:04Z"))));
verifyNoMoreInteractions(emitter);
}
@Test
public void test_isBeforeIsAfterIsEqual_instantComparison() {
OffsetDateTime a = OffsetDateTime.of(2008, 6, 30, 10, 0, 0, 0, OFFSET_PONE);
OffsetDateTime b = OffsetDateTime.of(2008, 6, 30, 11, 0, 0, 0, OFFSET_PTWO); // a is same instant as b
assertEquals(a.isBefore(b), false);
assertEquals(a.isEqual(b), true);
assertEquals(a.isAfter(b), false);
assertEquals(b.isBefore(a), false);
assertEquals(b.isEqual(a), true);
assertEquals(b.isAfter(a), false);
assertEquals(a.isBefore(a), false);
assertEquals(b.isBefore(b), false);
assertEquals(a.isEqual(a), true);
assertEquals(b.isEqual(b), true);
assertEquals(a.isAfter(a), false);
assertEquals(b.isAfter(b), false);
}
@Test
public void asDataPointsShouldReturnCorrectDataPoints() {
SleepDuration2 expectedSleepDuration = new SleepDuration2.Builder(
new DurationUnitValue(MINUTE, 112),
ofStartDateTimeAndEndDateTime(
OffsetDateTime.parse("2016-12-13T01:16:00.000Z"),
OffsetDateTime.parse("2016-12-13T03:14:00.000Z")
))
.build();
List<DataPoint<SleepDuration2>> dataPoints = mapper.asDataPoints(sleepDateResponseNode);
DataPoint<SleepDuration2> dataPoint = dataPoints.get(1);
assertThat(dataPoint.getBody(), equalTo(expectedSleepDuration));
assertThat(dataPoint.getHeader().getBodySchemaId(), equalTo(SleepDuration2.SCHEMA_ID));
assertThat(dataPoint.getHeader().getAcquisitionProvenance().getSourceName(),
equalTo(FitbitDataPointMapper.RESOURCE_API_SOURCE_NAME));
}
private void doTest_factory_ofInstant_all(long minYear, long maxYear) {
long days_0000_to_1970 = (146097 * 5) - (30 * 365 + 7);
int minOffset = (minYear <= 0 ? 0 : 3);
int maxOffset = (maxYear <= 0 ? 0 : 3);
long minDays = (minYear * 365L + ((minYear + minOffset) / 4L - (minYear + minOffset) / 100L + (minYear + minOffset) / 400L)) - days_0000_to_1970;
long maxDays = (maxYear * 365L + ((maxYear + maxOffset) / 4L - (maxYear + maxOffset) / 100L + (maxYear + maxOffset) / 400L)) + 365L - days_0000_to_1970;
final LocalDate maxDate = LocalDate.of(Year.MAX_VALUE, 12, 31);
OffsetDateTime expected = OffsetDateTime.of(LocalDate.of((int) minYear, 1, 1), LocalTime.of(0, 0, 0, 0), ZoneOffset.UTC);
for (long i = minDays; i < maxDays; i++) {
Instant instant = Instant.ofEpochSecond(i * 24L * 60L * 60L);
try {
OffsetDateTime test = OffsetDateTime.ofInstant(instant, ZoneOffset.UTC);
assertEquals(test, expected);
if (expected.toLocalDate().equals(maxDate) == false) {
expected = expected.plusDays(1);
}
} catch (RuntimeException|Error ex) {
System.out.println("Error: " + i + " " + expected);
throw ex;
}
}
}
/**
* Get multiple tasks
* Returns the compact task records for some filtered set of tasks. Use one or more of the parameters provided to filter the tasks returned. You must specify a `project` or `tag` if you do not specify `assignee` and `workspace`. For more complex task retrieval, use [workspaces/{workspace_gid}/tasks/search](#search-tasks-in-a-workspace).
* @param modifiedSince Only return tasks that have been modified since the given time. *Note: A task is considered “modified” if any of its properties change, or associations between it and other objects are modified (e.g. a task being added to a project). A task is not considered modified just because another object it is associated with (e.g. a subtask) is modified. Actions that count as modifying the task include assigning, renaming, completing, and adding stories.* (optional)
* @param completedSince Only return tasks that are either incomplete or that have been completed since this time. (optional)
* @param workspace The workspace to filter tasks on. *Note: If you specify `workspace`, you must also specify the `assignee` to filter on.* (optional)
* @param section The section to filter tasks on. *Note: Currently, this is only supported in board views.* (optional)
* @param project The project to filter tasks on. (optional)
* @param assignee The assignee to filter tasks on. *Note: If you specify `assignee`, you must also specify the `workspace` to filter on.* (optional)
* @param offset Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' (optional)
* @param limit Results per page. The number of objects to return per page. The value must be between 1 and 100. (optional)
* @param optFields Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. (optional)
* @param optPretty Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. (optional)
* @return CollectionRequest(Task)
* @throws IOException If we fail to call the API, e.g. server error or cannot deserialize the response body
*/
public CollectionRequest<Task> getTasks(OffsetDateTime modifiedSince, OffsetDateTime completedSince, String workspace, String section, String project, String assignee, String offset, Integer limit, List<String> optFields, Boolean optPretty) throws IOException {
String path = "/tasks";
CollectionRequest<Task> req = new CollectionRequest<Task>(this, Task.class, path, "GET")
.query("opt_pretty", optPretty)
.query("opt_fields", optFields)
.query("limit", limit)
.query("offset", offset)
.query("assignee", assignee)
.query("project", project)
.query("section", section)
.query("workspace", workspace)
.query("completed_since", completedSince)
.query("modified_since", modifiedSince);
return req;
}
public ResponseType() {
date = new Date(1499667166754L);
localDate = LocalDate.of(2017, 1, 1);
localTime = LocalTime.MIDNIGHT;
localDateTime = LocalDateTime.of(localDate, localTime);
offsetDateTime = OffsetDateTime.of(localDate, localTime, ZoneOffset.UTC);
}
@Override
public Object fromString(final String str) {
try {
return OffsetDateTime.parse(str);
} catch (final DateTimeParseException e) {
final ConversionException exception = new ConversionException("Cannot parse value as offset date time", e);
exception.add("value", str);
throw exception;
}
}
@Test
public void asDataPointsShouldReturnCorrectSelfReportedDataPoints() {
BodyMassIndex1 expectedBodyMassIndex = new BodyMassIndex1.Builder(
new TypedUnitValue<>(KILOGRAMS_PER_SQUARE_METER, 22.56052398681641))
.setEffectiveTimeFrame(OffsetDateTime.parse("2015-09-17T14:07:57-06:00"))
.setUserNotes("Weight so good, look at me now")
.build();
assertThat(dataPoints.get(1).getBody(), equalTo(expectedBodyMassIndex));
testDataPointHeader(dataPoints.get(1).getHeader(), SCHEMA_ID, SELF_REPORTED,
"b702a3a5e998f2fca268df6daaa69871", OffsetDateTime.parse("2015-09-17T20:08:00Z"));
}
/**
* Get an offset date time from the TOML document.
*
* @param path The key path.
* @return The value, or {@code null} if no value was set in the TOML document.
* @throws TomlInvalidTypeException If the value is present but not an {@link OffsetDateTime}, or any element of the
* path preceding the final key is not a table.
*/
@Nullable
default OffsetDateTime getOffsetDateTime(List<String> path) {
Object value = get(path);
if (value == null) {
return null;
}
if (!(value instanceof OffsetDateTime)) {
throw new TomlInvalidTypeException("Value of '" + joinKeyPath(path) + "' is a " + typeNameFor(value));
}
return (OffsetDateTime) value;
}
@Test(dataProvider="sampleTimes")
public void test_equals_false_hour_differs(int y, int o, int d, int h, int m, int s, int n, ZoneOffset ignored) {
h = (h == 23 ? 22 : h);
OffsetDateTime a = OffsetDateTime.of(y, o, d, h, m, s, n, OFFSET_PONE);
OffsetDateTime b = OffsetDateTime.of(y, o, d, h + 1, m, s, n, OFFSET_PONE);
assertEquals(a.equals(b), false);
}
@Test
public void test_with_adjuster_OffsetDateTime_validOffsetNotInOverlap() {
// ODT will be a valid ZDT for the zone, so must be retained exactly
OffsetDateTime odt = TEST_LOCAL_2008_06_30_11_30_59_500.atOffset(OFFSET_0200);
ZonedDateTime zdt = TEST_PARIS_OVERLAP_2008_10_26_02_30.atZone(ZONE_PARIS);
ZonedDateTime test = zdt.with(odt);
assertEquals(test.toOffsetDateTime(), odt);
}
/**
* Generates a new record namespace and adds the properties from the config to that record.
*
* @param config A {@link RecordOperationConfig} that contains the record configuration
* @param issued Time the record was issued
* @param modified Time the record was modified
* @return A {@link Record} of the provided config
*/
protected T createRecordObject(RecordOperationConfig config, OffsetDateTime issued, OffsetDateTime modified) {
T record = recordFactory.createNew(valueFactory.createIRI(Catalogs.RECORD_NAMESPACE + UUID.randomUUID()));
Literal titleLiteral = valueFactory.createLiteral(config.get(RecordCreateSettings.RECORD_TITLE));
Literal issuedLiteral = valueFactory.createLiteral(issued);
Literal modifiedLiteral = valueFactory.createLiteral(modified);
Set<Value> publishers = config.get(RecordCreateSettings.RECORD_PUBLISHERS).stream()
.map(user -> (Value) user.getResource())
.collect(Collectors.toSet());
IRI catalogIdIRI = valueFactory.createIRI(config.get(RecordCreateSettings.CATALOG_ID));
record.setCatalog(catalogFactory.createNew(catalogIdIRI));
record.setProperty(titleLiteral, valueFactory.createIRI(_Thing.title_IRI));
record.setProperty(issuedLiteral, valueFactory.createIRI(_Thing.issued_IRI));
record.setProperty(modifiedLiteral, valueFactory.createIRI(_Thing.modified_IRI));
record.setProperties(publishers, valueFactory.createIRI(_Thing.publisher_IRI));
if (config.get(RecordCreateSettings.RECORD_DESCRIPTION) != null
&& StringUtils.isNotEmpty(config.get(RecordCreateSettings.RECORD_DESCRIPTION))) {
record.setProperty(valueFactory.createLiteral(config.get(RecordCreateSettings.RECORD_DESCRIPTION)),
valueFactory.createIRI(_Thing.description_IRI));
}
if (config.get(RecordCreateSettings.RECORD_MARKDOWN) != null
&& StringUtils.isNotEmpty(config.get(RecordCreateSettings.RECORD_MARKDOWN))) {
record.setProperty(valueFactory.createLiteral(config.get(RecordCreateSettings.RECORD_MARKDOWN)),
valueFactory.createIRI(DCTERMS.ABSTRACT.stringValue()));
}
if (config.get(RecordCreateSettings.RECORD_KEYWORDS).size() > 0) {
record.setKeyword(config.get(RecordCreateSettings.RECORD_KEYWORDS).stream()
.map(valueFactory::createLiteral).collect(Collectors.toSet()));
}
return record;
}
@Test
public void test_Instant_zonedDateTime() {
OffsetDateTime offsetDateTime = OffsetDateTime.of(2012, 2, 29, 2, 7, 1, 1, OFFSET_PTWO);
ZonedDateTime zonedDateTime = ZonedDateTime.of(2012, 2, 29, 2, 7, 1, 1, ZONE_RIYADH);
ChronoZonedDateTime<HijrahDate> result = HijrahChronology.INSTANCE.zonedDateTime(offsetDateTime.toInstant(), offsetDateTime.getOffset());
assertEquals(result.toLocalDate(), HijrahChronology.INSTANCE.date(1433, 4, 7));
assertEquals(result.toLocalTime(), LocalTime.of(2, 7, 1, 1));
result = HijrahChronology.INSTANCE.zonedDateTime(zonedDateTime.toInstant(), zonedDateTime.getOffset());
assertEquals(result.toLocalDate(), HijrahChronology.INSTANCE.date(1433, 4, 7));
assertEquals(result.toLocalTime(), LocalTime.of(2, 7, 1, 1));
}
@Test
public void test_compareTo_timeSecs() {
OffsetDateTime a = OffsetDateTime.of(2008, 6, 30, 11, 29, 2, 0, OFFSET_PONE);
OffsetDateTime b = OffsetDateTime.of(2008, 6, 30, 11, 29, 3, 0, OFFSET_PONE); // a is before b due to time
assertEquals(a.compareTo(b) < 0, true);
assertEquals(b.compareTo(a) > 0, true);
assertEquals(a.compareTo(a) == 0, true);
assertEquals(b.compareTo(b) == 0, true);
assertEquals(a.toInstant().compareTo(b.toInstant()) < 0, true);
assertEquals(OffsetDateTime.timeLineOrder().compare(a, b) < 0, true);
}
@Test
public void test_with_adjustment() {
final OffsetDateTime sample = OffsetDateTime.of(LocalDate.of(2012, 3, 4), LocalTime.of(23, 5), OFFSET_PONE);
TemporalAdjuster adjuster = new TemporalAdjuster() {
@Override
public Temporal adjustInto(Temporal dateTime) {
return sample;
}
};
assertEquals(TEST_2008_6_30_11_30_59_000000500.with(adjuster), sample);
}
/**
* Get dateTime
* @return dateTime
*/
@ApiModelProperty(value = "")
@Valid
public OffsetDateTime getDateTime() {
return dateTime;
}
@InvokeEvent
public void joinSingleplayer(SingleplayerJoinEvent event) {
RichPresence.Builder builder = new RichPresence.Builder();
client.sendRichPresence(builder
.setSmallImage("compass")
.setLargeImage("hyperium", "Hyperium Client")
.setState("IGN: " + Minecraft.getMinecraft().getSession().getUsername())
.setDetails("Playing Singleplayer")
.setStartTimestamp(OffsetDateTime.now())
.build());
}
@Test(dataProvider = "withFieldLong")
public void test_with_adjuster_ensureOffsetDateTimeConsistent(ZonedDateTime base, TemporalField setField, int setValue, ZonedDateTime expected) {
if (setField == OFFSET_SECONDS) {
OffsetDateTime odt = base.toOffsetDateTime().with(setField, setValue);
assertEquals(base.with(odt), expected);
}
}
@Test
public void test_compareTo_bothNanos() {
OffsetDateTime a = OffsetDateTime.of(2008, 6, 30, 11, 20, 40, 4, OFFSET_PTWO);
OffsetDateTime b = OffsetDateTime.of(2008, 6, 30, 10, 20, 40, 5, OFFSET_PONE); // a is before b on instant scale
assertEquals(a.compareTo(b) < 0, true);
assertEquals(b.compareTo(a) > 0, true);
assertEquals(a.compareTo(a) == 0, true);
assertEquals(b.compareTo(b) == 0, true);
assertEquals(a.toInstant().compareTo(b.toInstant()) < 0, true);
assertEquals(OffsetDateTime.timeLineOrder().compare(a, b) < 0, true);
}
@Override
protected boolean encodeNonNullObject(Object object, JsonGenerator out) throws IOException {
OffsetDateTime dateTime = (OffsetDateTime) object;
String formatted = DateTimeFormatters.isoOffsetDateTime().format(dateTime);
out.writeObject(formatted);
return true;
}
@Test
public void test_compareTo_both() {
OffsetDateTime a = OffsetDateTime.of(2008, 6, 30, 11, 50, 0, 0, OFFSET_PTWO);
OffsetDateTime b = OffsetDateTime.of(2008, 6, 30, 11, 20, 0, 0, OFFSET_PONE); // a is before b on instant scale
assertEquals(a.compareTo(b) < 0, true);
assertEquals(b.compareTo(a) > 0, true);
assertEquals(a.compareTo(a) == 0, true);
assertEquals(b.compareTo(b) == 0, true);
assertEquals(a.toInstant().compareTo(b.toInstant()) < 0, true);
assertEquals(OffsetDateTime.timeLineOrder().compare(a, b) < 0, true);
}
@Test
public void demo() {
Date date = DateParserUtils.parseDate("12-Dec-05");
System.out.println(date);
Calendar calendar = DateParserUtils.parseCalendar("Fri Jul 03 2015 18:04:07 GMT+0100 (GMT Daylight Time)");
System.out.println(calendar.toInstant());
LocalDateTime dateTime = DateParserUtils.parseDateTime("2019-09-20 10:20:30.12345678 +0200");
System.out.println(dateTime);
OffsetDateTime offsetDateTime = DateParserUtils.parseOffsetDateTime("2015-09-30 18:48:56.35272715 +0000 UTC");
System.out.println(offsetDateTime);
}
@Override
public FieldWrapper visit(Path path) {
PathState<J> state = new PathState<>();
state.pathTableRef = tableRef;
state.elements = path.getElements();
for (state.curIndex = 0; state.curIndex < state.elements.size() && !state.finished; state.curIndex++) {
Property element = state.elements.get(state.curIndex);
if (element instanceof CustomProperty) {
handleCustomProperty(state, path);
} else if (element instanceof CustomPropertyLink) {
handleCustomProperty(state, path);
} else if (element instanceof EntityProperty) {
handleEntityProperty(state, path, element);
} else if (element instanceof NavigationPropertyMain) {
handleNavigationProperty(state, path, element);
}
}
if (state.finalExpression == null) {
throw new IllegalArgumentException("Path does not end in an EntityProperty: " + path);
}
if (state.finalExpression instanceof Field) {
Field field = (Field) state.finalExpression;
if (OffsetDateTime.class.isAssignableFrom(field.getType())) {
Field<OffsetDateTime> dateTimePath = (Field<OffsetDateTime>) state.finalExpression;
state.finalExpression = new StaDateTimeWrapper(dateTimePath);
}
}
return state.finalExpression;
}
public void factory_ofInstant_minWithMinOffset() {
long days_0000_to_1970 = (146097 * 5) - (30 * 365 + 7);
int year = Year.MIN_VALUE;
long days = (year * 365L + (year / 4 - year / 100 + year / 400)) - days_0000_to_1970;
Instant instant = Instant.ofEpochSecond(days * 24L * 60L * 60L - OFFSET_MIN.getTotalSeconds());
OffsetDateTime test = OffsetDateTime.ofInstant(instant, OFFSET_MIN);
assertEquals(test.getYear(), Year.MIN_VALUE);
assertEquals(test.getMonth().getValue(), 1);
assertEquals(test.getDayOfMonth(), 1);
assertEquals(test.getOffset(), OFFSET_MIN);
assertEquals(test.getHour(), 0);
assertEquals(test.getMinute(), 0);
assertEquals(test.getSecond(), 0);
assertEquals(test.getNano(), 0);
}
@Test
public void asOptionalOffsetDateTimeShouldReturnEmptyOnMissingNode() {
Optional<OffsetDateTime> value = asOptionalOffsetDateTime(testNode, "foo");
assertThat(value, notNullValue());
assertThat(value.isPresent(), equalTo(false));
}
private void testTime(String fmtStr, Locale locale,
ChronoZonedDateTime<?> zdt, Calendar cal) {
printFmtStr(locale, fmtStr);
String expected = test(fmtStr, locale, null, cal);
test(fmtStr, locale, expected, zdt);
test(fmtStr, locale, expected, zdt.toLocalDateTime());
test(fmtStr, locale, expected, zdt.toLocalTime());
if (zdt instanceof ZonedDateTime) {
OffsetDateTime odt = ((ZonedDateTime)zdt).toOffsetDateTime();
test(fmtStr, locale, expected, odt);
test(fmtStr, locale, expected, odt.toOffsetTime());
}
}
public Order (Long id, Long petId, Integer quantity, OffsetDateTime shipDate, StatusEnum status, Boolean complete) {
this.id = id;
this.petId = petId;
this.quantity = quantity;
this.shipDate = shipDate;
this.status = status;
this.complete = complete;
}
@Override
public OffsetDateTime deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException {
final String value = jsonParser.getValueAsString();
if (StringUtils.isEmpty(value)) {
return null;
}
try {
return OffsetDateTime.parse(value);
}
catch (DateTimeParseException exception) {
return OffsetDateTime.parse(value + CURRENT_ZONE_OFFSET);
}
}
@Test
public void test_toEpochSecond_afterEpoch() {
for (int i = 0; i < 100000; i++) {
OffsetDateTime a = OffsetDateTime.of(1970, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC).plusSeconds(i);
assertEquals(a.toEpochSecond(), i);
}
}