/** * If the next thing in <code>line</code> is a timestamp, it is parsed and returned. If there * is no timestamp present, the timestamp is calculated * * @param line current line * @param pos current parse positition * @param datestamp datestamp that may have been parsed * @return timestamp (either parsed or derived from datestamp) * @throws ParseException it seemed to be a timestamp but still couldn't be parsed */ protected double getTimestamp(final String line, final ParseInformation pos, final ZonedDateTime datestamp) throws ParseException { double timestamp = 0; if (nextIsTimestamp(line, pos)) { timestamp = parseTimestamp(line, pos); } else if (datestamp != null && pos.getFirstDateStamp() != null) { // if no timestamp was present, calculate difference between last and this date timestamp = pos.getFirstDateStamp().until(datestamp, ChronoUnit.MILLIS) / (double) 1000; } return timestamp; }
// java.time ZonedDateTime startZdt = ZonedDateTime.of( 2015, 06, 30, 23, 59, 00, 00, ZoneOffset.UTC ); ZonedDateTime stopZdt = ZonedDateTime.of( 2015, 07, 01, 00, 01, 00, 00, ZoneOffset.UTC ); long elapsedMillisZdt = startZdt.until( stopZdt, ChronoUnit.MILLIS ); System.out.println( "startZdt: " + startZdt + " stopZdt: " + stopZdt + " = elapsedMillisZdt: " + elapsedMillisZdt );
ZonedDateTime now = ZonedDateTime.now(); // Do stuff long seconds = now.until(ZonedDateTime.now(), ChronoUnit.SECONDS);
@Managed public Long getDaysUntilCertificateExpiration() { return certificateExpiration.map(date -> ZonedDateTime.now().until(date, DAYS)) .orElse(null); }
@Managed public Long getDaysUntilCertificateExpiration() { return certificateExpiration.map(date -> ZonedDateTime.now().until(date, DAYS)) .orElse(null); }
@Managed public Long getDaysUntilCertificateExpiration() { return certificateExpiration.map(date -> ZonedDateTime.now().until(date, DAYS)) .orElse(null); }
public Log(Application application, SuggestionSearch search, SuggestionResult result, ZonedDateTime start, ZonedDateTime end, Session session) { values = new HashMap<>(); values.put("application", application); values.put("session", session); //values.put("module", module); values.put("timestamp", DateTimeFormatter.ofPattern(SOLR_DATE_TIME_FORMAT).format(start.withZoneSameInstant(ZoneOffset.UTC))); values.put("type","suggestion"); values.put("request",new SuggestionRequest(search, "suggestion")); values.put("response",new Response(result.size(), result.getSuggestedFields().size() ,start.until(end, ChronoUnit.MILLIS))); }
ZonedDateTime zdt = ZonedDateTime.now(ZoneId.of("US/Eastern")); ZonedDateTime target2 = zdt .withHour(15) .withMinute(0) .withSecond(0) .withNano(0); if (target2.isBefore(zdt)) { zdt = zdt.plusDays(1); } System.out.println(zdt.until(target2, ChronoUnit.MILLIS));
long nextDeliveryDelay = ZonedDateTime.now().until(next.get(), ChronoUnit.MILLIS); scheduler.schedule(() -> { try {
public FullTextEntry(Application application, String source, FulltextSearch search, BeanSearchResult result, ZonedDateTime start, ZonedDateTime end, Session session) { this.application = application; this.session = session; this.timeStamp = start; this.request = new FullTextRequest(search,source); this.response = new Response(result.getNumOfResults(), start.until(end, ChronoUnit.MILLIS)); this.sorting = search.getSorting().toString(); }
final ModelAndView modelAndView = new ModelAndView(MONITORING_VIEW_STATISTICS); modelAndView.addObject("startTime", this.upTimeStartDate); final double difference = this.upTimeStartDate.until(ZonedDateTime.now(ZoneOffset.UTC), ChronoUnit.MILLIS);
final ScheduledExecutorService executor = /* ... */ ; Runnable task = new Runnable() { @Override public void run() { ZonedDateTime now = ZonedDateTime.now(); long delay = now.until(now.plusMonths(1), ChronoUnit.MILLIS); try { // ... } finally { executor.schedule(this, delay, TimeUnit.MILLISECONDS); } } }; int dayOfMonth = 5; ZonedDateTime dateTime = ZonedDateTime.now(); if (dateTime.getDayOfMonth() >= dayOfMonth) { dateTime = dateTime.plusMonths(1); } dateTime = dateTime.withDayOfMonth(dayOfMonth); executor.schedule(task, ZonedDateTime.now().until(dateTime, ChronoUnit.MILLIS), TimeUnit.MILLISECONDS);
final long millis = zddate.until(zdtime, java.time.temporal.ChronoUnit.MILLIS); return millis;
public FullTextEntry(Application application, String source, FulltextSearch search, SearchResult result, ZonedDateTime start, ZonedDateTime end, Session session) { this.application = application; this.session = session; this.timeStamp = start; this.request = new FullTextRequest(search,source); this.response = new Response(result.getNumOfResults(), start.until(end, ChronoUnit.MILLIS)); this.sorting = search.getSorting().toString(); this.paging = new Paging(search.getResultSet()); }
final long millis = zddate.until(zdtime, java.time.temporal.ChronoUnit.MILLIS); return millis;
final long millis = zddate.until(zdtime, java.time.temporal.ChronoUnit.MILLIS); return millis;
final Duration currentIntervalDuration = Duration.of(currentTime.until(timerResetTime, timeUnit), timeUnit) .dividedBy(eventCount);
final Duration currentIntervalDuration = Duration.of(currentTime.until(timerResetTime, timeUnit), timeUnit) .dividedBy(eventCount);