當前位置: 首頁>>代碼示例>>Java>>正文


Java Instant.getMillis方法代碼示例

本文整理匯總了Java中org.joda.time.Instant.getMillis方法的典型用法代碼示例。如果您正苦於以下問題:Java Instant.getMillis方法的具體用法?Java Instant.getMillis怎麽用?Java Instant.getMillis使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.joda.time.Instant的用法示例。


在下文中一共展示了Instant.getMillis方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: assignWindow

import org.joda.time.Instant; //導入方法依賴的package包/類
@Override
public IntervalWindow assignWindow(Instant timestamp) {
  Instant start =
      new Instant(
          timestamp.getMillis()
              - timestamp.plus(size).minus(offset).getMillis() % size.getMillis());


  // The global window is inclusive of max timestamp, while interval window excludes its
  // upper bound
  Instant endOfGlobalWindow = GlobalWindow.INSTANCE.maxTimestamp().plus(1);

  // The end of the window is either start + size if that is within the allowable range, otherwise
  // the end of the global window. Truncating the window drives many other
  // areas of this system in the appropriate way automatically.
  //
  // Though it is curious that the very last representable fixed window is shorter than the rest,
  // when we are processing data in the year 294247, we'll probably have technology that can
  // account for this.
  Instant end =
      start.isAfter(endOfGlobalWindow.minus(size)) ? endOfGlobalWindow : start.plus(size);

  return new IntervalWindow(start, end);
}
 
開發者ID:apache,項目名稱:beam,代碼行數:25,代碼來源:FixedWindows.java

示例2: getExpiredCustomerCount

import org.joda.time.Instant; //導入方法依賴的package包/類
/**
 * Returns the number of individual customers who may withdraw from this
 * subscription without penalty. Should return the total customer count
 * for a non-expiring tariff.
 */
public int getExpiredCustomerCount ()
{
  int cc = 0;
  Instant today =
          getTimeService().truncateInstant(getTimeService().getCurrentTime(),
                                           TimeService.DAY);
  for (ExpirationRecord exp : expirations) {
    if (exp.getHorizon() <= today.getMillis()) {
      cc += exp.getCount();
    }
  }
  return cc;
}
 
開發者ID:LARG,項目名稱:TacTex,代碼行數:19,代碼來源:TariffSubscription.java

示例3: windowStart

import org.joda.time.Instant; //導入方法依賴的package包/類
/**
 * Return the start of the most recent window of {@code size} and {@code period} which ends
 * strictly before {@code timestamp}.
 */
static Instant windowStart(Duration size, Duration period, Instant timestamp) {
  long ts = timestamp.getMillis();
  long p = period.getMillis();
  long lim = ts - ts % p;
  long s = size.getMillis();
  return new Instant(lim - s);
}
 
開發者ID:apache,項目名稱:beam,代碼行數:12,代碼來源:NexmarkQueryModel.java

示例4: updateCounts

import org.joda.time.Instant; //導入方法依賴的package包/類
/**
 * Update window and counts.
 */
private void updateCounts(Instant timestamp) {
  long window = timestamp.getMillis() - timestamp.getMillis() % WINDOW_SIZE.getMillis();
  if (window > currentWindow) {
    if (currentWindow > BoundedWindow.TIMESTAMP_MIN_VALUE.getMillis()) {
      pendingCounts.add(currentCount);
    }
    currentCount = 0;
    currentWindow = window;
  }
  currentCount++;
}
 
開發者ID:apache,項目名稱:beam,代碼行數:15,代碼來源:AbstractSimulator.java

示例5: encode

import org.joda.time.Instant; //導入方法依賴的package包/類
@Override
public void encode(Instant value, OutputStream outStream) throws CoderException, IOException {
  if (value == null) {
    throw new CoderException("cannot encode a null Instant");
  }

  // Converts {@link Instant} to a {@code long} representing its millis-since-epoch,
  // but shifted so that the byte representation of negative values are lexicographically
  // ordered before the byte representation of positive values.
  //
  // This deliberately utilizes the well-defined underflow for {@code long} values.
  // See http://docs.oracle.com/javase/specs/jls/se7/html/jls-15.html#jls-15.18.2
  long shiftedMillis = value.getMillis() - Long.MIN_VALUE;
  new DataOutputStream(outStream).writeLong(shiftedMillis);
}
 
開發者ID:apache,項目名稱:beam,代碼行數:16,代碼來源:InstantCoder.java

示例6: getIndex

import org.joda.time.Instant; //導入方法依賴的package包/類
int getIndex (Instant when)
{
  int result = (int)((when.getMillis() - timeService.getBase()) /
                     (Competition.currentCompetition().getTimeslotDuration()));
  return result;
}
 
開發者ID:LARG,項目名稱:TacTex,代碼行數:7,代碼來源:PortfolioManagerService.java

示例7: lastStartFor

import org.joda.time.Instant; //導入方法依賴的package包/類
/**
 * Return the last start of a sliding window that contains the timestamp.
 */
private long lastStartFor(Instant timestamp) {
  return timestamp.getMillis()
      - timestamp.plus(period).minus(offset).getMillis() % period.getMillis();
}
 
開發者ID:apache,項目名稱:beam,代碼行數:8,代碼來源:SlidingWindows.java


注:本文中的org.joda.time.Instant.getMillis方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。