本文整理了Java中org.joda.time.LocalDateTime.isBefore()
方法的一些代码示例,展示了LocalDateTime.isBefore()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。LocalDateTime.isBefore()
方法的具体详情如下:
包路径:org.joda.time.LocalDateTime
类名称:LocalDateTime
方法名:isBefore
暂无
代码示例来源:origin: joda-time/joda-time
calendar.setTime(date);
LocalDateTime check = LocalDateTime.fromCalendarFields(calendar);
if (check.isBefore(this)) {
while (check.isBefore(this)) {
calendar.setTimeInMillis(calendar.getTimeInMillis() + 60000);
check = LocalDateTime.fromCalendarFields(calendar);
while (check.isBefore(this) == false) {
calendar.setTimeInMillis(calendar.getTimeInMillis() - 1000);
check = LocalDateTime.fromCalendarFields(calendar);
代码示例来源:origin: JodaOrg/joda-time
calendar.setTime(date);
LocalDateTime check = LocalDateTime.fromCalendarFields(calendar);
if (check.isBefore(this)) {
while (check.isBefore(this)) {
calendar.setTimeInMillis(calendar.getTimeInMillis() + 60000);
check = LocalDateTime.fromCalendarFields(calendar);
while (check.isBefore(this) == false) {
calendar.setTimeInMillis(calendar.getTimeInMillis() - 1000);
check = LocalDateTime.fromCalendarFields(calendar);
代码示例来源:origin: camunda/camunda-bpm-platform
date.setTime(date.getTime() + getMillisOfSecond());
LocalDateTime check = LocalDateTime.fromDateFields(date);
if (check.isBefore(this)) {
while (check.isBefore(this)) {
date.setTime(date.getTime() + 60000);
check = LocalDateTime.fromDateFields(date);
while (check.isBefore(this) == false) {
date.setTime(date.getTime() - 1000);
check = LocalDateTime.fromDateFields(date);
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.joda-time
calendar.setTime(date);
LocalDateTime check = LocalDateTime.fromCalendarFields(calendar);
if (check.isBefore(this)) {
while (check.isBefore(this)) {
calendar.setTimeInMillis(calendar.getTimeInMillis() + 60000);
check = LocalDateTime.fromCalendarFields(calendar);
while (check.isBefore(this) == false) {
calendar.setTimeInMillis(calendar.getTimeInMillis() - 1000);
check = LocalDateTime.fromCalendarFields(calendar);
代码示例来源:origin: io.virtdata/virtdata-lib-realer
calendar.setTime(date);
LocalDateTime check = LocalDateTime.fromCalendarFields(calendar);
if (check.isBefore(this)) {
while (check.isBefore(this)) {
calendar.setTimeInMillis(calendar.getTimeInMillis() + 60000);
check = LocalDateTime.fromCalendarFields(calendar);
while (check.isBefore(this) == false) {
calendar.setTimeInMillis(calendar.getTimeInMillis() - 1000);
check = LocalDateTime.fromCalendarFields(calendar);
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-analytics
calendar.setTime(date);
LocalDateTime check = LocalDateTime.fromCalendarFields(calendar);
if (check.isBefore(this)) {
while (check.isBefore(this)) {
calendar.setTimeInMillis(calendar.getTimeInMillis() + 60000);
check = LocalDateTime.fromCalendarFields(calendar);
while (check.isBefore(this) == false) {
calendar.setTimeInMillis(calendar.getTimeInMillis() - 1000);
check = LocalDateTime.fromCalendarFields(calendar);
代码示例来源:origin: Nextdoor/bender
calendar.setTime(date);
LocalDateTime check = LocalDateTime.fromCalendarFields(calendar);
if (check.isBefore(this)) {
while (check.isBefore(this)) {
calendar.setTimeInMillis(calendar.getTimeInMillis() + 60000);
check = LocalDateTime.fromCalendarFields(calendar);
while (check.isBefore(this) == false) {
calendar.setTimeInMillis(calendar.getTimeInMillis() - 1000);
check = LocalDateTime.fromCalendarFields(calendar);
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
calendar.setTime(date);
LocalDateTime check = LocalDateTime.fromCalendarFields(calendar);
if (check.isBefore(this)) {
while (check.isBefore(this)) {
calendar.setTimeInMillis(calendar.getTimeInMillis() + 60000);
check = LocalDateTime.fromCalendarFields(calendar);
while (check.isBefore(this) == false) {
calendar.setTimeInMillis(calendar.getTimeInMillis() - 1000);
check = LocalDateTime.fromCalendarFields(calendar);
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
calendar.setTime(date);
LocalDateTime check = LocalDateTime.fromCalendarFields(calendar);
if (check.isBefore(this)) {
while (check.isBefore(this)) {
calendar.setTimeInMillis(calendar.getTimeInMillis() + 60000);
check = LocalDateTime.fromCalendarFields(calendar);
while (check.isBefore(this) == false) {
calendar.setTimeInMillis(calendar.getTimeInMillis() - 1000);
check = LocalDateTime.fromCalendarFields(calendar);
代码示例来源:origin: org.swisspush.gateleen/gateleen-hook
public void handle(Long timerID) {
log.trace("Running hook cleanup ...");
LocalDateTime nowAsTime = ExpiryCheckHandler.getActualTime();
// Loop through listeners first
for (Listener listener : listenerRepository.getListeners()) {
final Optional<LocalDateTime> expirationTime = listener.getHook().getExpirationTime();
if (!expirationTime.isPresent()) {
log.trace("Listener " + listener.getListenerId() + " will never expire.");
} else if (expirationTime.get().isBefore(nowAsTime)) {
log.debug("Listener " + listener.getListenerId() + " expired at " + expirationTime.get() + " and actual time is " + nowAsTime);
listenerRepository.removeListener(listener.getListenerId());
routeRepository.removeRoute(hookRootUri + LISTENER_HOOK_TARGET_PATH + listener.getListenerId());
}
}
// Loop through routes
Map<String, Route> routes = routeRepository.getRoutes();
for (String key : routes.keySet()) {
Route route = routes.get(key);
final Optional<LocalDateTime> expirationTime = route.getHook().getExpirationTime();
if (!expirationTime.isPresent()) {
log.trace("Route " + key + " will never expire.");
} else if (expirationTime.get().isBefore(nowAsTime)) {
routeRepository.removeRoute(key);
}
}
monitoringHandler.updateListenerCount(listenerRepository.size());
monitoringHandler.updateRoutesCount(routeRepository.getRoutes().size());
log.trace("done");
}
});
代码示例来源:origin: org.swisspush/gateleen-queue
/**
* Checks the expiration based on the given headers.
* If no "X-Expire-After" or "X-Server-Timestamp" is found <code>false</code> is returned.
*
* @param headers headers
* @return true if the request has expired, false otherwise
*/
public static boolean isExpired(MultiMap headers) {
if (headers != null) {
Integer expireAfter = getExpireAfter(headers);
String serverTimestamp = headers.get(SERVER_TIMESTAMP_HEADER);
if (serverTimestamp != null && expireAfter != null) {
LocalDateTime timestamp = parseDateTime(serverTimestamp);
LocalDateTime expirationTime = getExpirationTime(timestamp, expireAfter);
LocalDateTime now = getActualTime();
log.debug(" > isExpired - timestamp " + timestamp + " | expirationTime " + expirationTime + " | now " + now);
// request expired?
return expirationTime.isBefore(now);
}
}
return false;
}
代码示例来源:origin: com.github.blasd.apex/apex-java
protected void logIfMemoryOverCap() {
long heapUsed = getUsedHeap();
long heapMax = getMaxHeap();
if (isOverThreashold(heapUsed, heapMax)) {
LocalDateTime now = new LocalDateTime();
overHeapThresholdSince.compareAndSet(null, now);
LocalDateTime overThresholdSince = overHeapThresholdSince.get();
if (overThresholdSince != null
&& overThresholdSince.isBefore(now.minusMinutes(HEAP_ALERT_PERIOD_IN_MINUTES))) {
// We are over heapThreshold since more than 15 minutes
overHeapThresholdSince.set(null);
onOverHeapAlertSinceTooLong(overThresholdSince);
}
} else {
overHeapThresholdSince.getAndUpdate(current -> {
if (current != null) {
onMemoryBackUnderThreshold(heapUsed, heapMax);
}
return null;
});
}
}
代码示例来源:origin: org.swisspush.gateleen/gateleen-queue
/**
* Checks the expiration based on the given headers.
* If "X-Expire-After" or "x-queue-expire-after" and
* no "X-Server-Timestamp" is found <code>false</code>
* is returned.
*
* @param headers headers
* @return true if the request has expired, false otherwise
*/
public static boolean isExpired(MultiMap headers) {
if (headers != null) {
Integer queueExpireAfter = getQueueExpireAfter(headers);
Integer expireAfter = getExpireAfter(headers);
String serverTimestamp = headers.get(SERVER_TIMESTAMP_HEADER);
// override expireAfter if x-queue-expire-after header is set
if ( queueExpireAfter != null ) {
expireAfter = queueExpireAfter;
}
if (serverTimestamp != null && expireAfter != null) {
LocalDateTime timestamp = parseDateTime(serverTimestamp);
LocalDateTime expirationTime = getExpirationTime(timestamp, expireAfter);
LocalDateTime now = getActualTime();
log.debug(" > isExpired - timestamp " + timestamp + " | expirationTime " + expirationTime + " | now " + now);
// request expired?
return expirationTime.isBefore(now);
}
}
return false;
}
代码示例来源:origin: tcplugins/tcWebHooks
@Override
public int compare(WebHookHistoryItem o1, WebHookHistoryItem o2) {
if (sortDirection == SortDirection.DESC) {
if (o1.getTimestamp().isBefore(o2.getTimestamp())){
return 1;
} else if (o1.getTimestamp().isAfter(o2.getTimestamp())){
return -1;
} else {
return 0;
}
} else {
if (o1.getTimestamp().isAfter(o2.getTimestamp())){
return 1;
} else if (o1.getTimestamp().isBefore(o2.getTimestamp())){
return -1;
} else {
return 0;
}
}
}
}
代码示例来源:origin: te-con/ehour
LocalDateTime end = new LocalDateTime(projectAssignment.getDateEnd());
if (now.isBefore(start)) {
percentage = Optional.of(0f);
} else if (now.isAfter(end)) {
代码示例来源:origin: effektif/effektif
if (atTime.isBefore(time)) {
time = atTime.plusDays(1);
} else {
代码示例来源:origin: org.assertj/assertj-joda-time
/**
* Verifies that the actual {@code LocalDateTime} is <b>strictly</b> before the given one.
* <p>
* Example :
* <pre><code class='java'> assertThat(new LocalDateTime("2000-01-01")).isBefore(new LocalDateTime("2000-01-02"));</code></pre>
*
* @param other the given {@link LocalDateTime}.
* @return this assertion object.
* @throws AssertionError if the actual {@code LocalDateTime} is {@code null}.
* @throws IllegalArgumentException if other {@code LocalDateTime} is {@code null}.
* @throws AssertionError if the actual {@code LocalDateTime} is not strictly before the given one.
*/
public LocalDateTimeAssert isBefore(LocalDateTime other) {
Objects.instance().assertNotNull(info, actual);
assertLocalDateTimeParameterIsNotNull(other);
if (!actual.isBefore(other)) {
throw Failures.instance().failure(info, shouldBeBefore(actual, other));
}
return this;
}
代码示例来源:origin: org.assertj/assertj-joda-time
/**
* Verifies that the actual {@code LocalDateTime} is after or equals to the given one.
* <p>
* Example :
* <pre><code class='java'> assertThat(new LocalDateTime("2000-01-01")).isAfterOrEqualTo(new LocalDateTime("2000-01-01"))
* .isAfterOrEqualTo(new LocalDateTime("1999-12-31"));</code></pre>
*
* @param other the given {@link LocalDateTime}.
* @return this assertion object.
* @throws AssertionError if the actual {@code LocalDateTime} is {@code null}.
* @throws IllegalArgumentException if other {@code LocalDateTime} is {@code null}.
* @throws AssertionError if the actual {@code LocalDateTime} is not after or equals to the given one.
*/
public LocalDateTimeAssert isAfterOrEqualTo(LocalDateTime other) {
Objects.instance().assertNotNull(info, actual);
assertLocalDateTimeParameterIsNotNull(other);
if (actual.isBefore(other)) {
throw Failures.instance().failure(info, shouldBeAfterOrEqualsTo(actual, other));
}
return this;
}
代码示例来源:origin: com.effektif/effektif-workflow-api
if (atTime.isBefore(time)) {
time = atTime.plusDays(1);
} else {
代码示例来源:origin: itesla/ipst
private boolean matches(HistoKey k, Map<String, Object> map, QueryParams query) {
if (query.getHorizon() != null && !query.getHorizon().equals(k.getHorizon())) {
return false;
}
if (query.getDayTimeFrom() != null && query.getDayTimeTo() != null) {
LocalDateTime check = new DateTime(k.getDateTime()).toLocalDateTime();
LocalDateTime from = new DateTime(query.getDayTimeFrom()).toLocalDateTime();
LocalDateTime to = new DateTime(query.getDayTimeTo()).toLocalDateTime();
LocalDateTime start = new DateTime(k.getDateTime()).toLocalDateTime().withHourOfDay(from.getHourOfDay())
.withMinuteOfHour(from.getMinuteOfHour()).withSecondOfMinute(from.getSecondOfMinute());
LocalDateTime end = new DateTime(k.getDateTime()).toLocalDateTime().withHourOfDay(to.getHourOfDay())
.withMinuteOfHour(to.getMinuteOfHour()).withSecondOfMinute(to.getSecondOfMinute());
if (check.isAfter(end) || check.isBefore(start)) {
return false;
}
}
if (query.getForecastTime() >= 0) {
if (k.getForecastDistance() != query.getForecastTime()) {
return false;
}
}
return true;
}
内容来源于网络,如有侵权,请联系作者删除!