org.bitcoinj.core.Utils.currentTimeMillis()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(5.1k)|赞(0)|评价(0)|浏览(133)

本文整理了Java中org.bitcoinj.core.Utils.currentTimeMillis()方法的一些代码示例,展示了Utils.currentTimeMillis()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Utils.currentTimeMillis()方法的具体详情如下:
包路径:org.bitcoinj.core.Utils
类名称:Utils
方法名:currentTimeMillis

Utils.currentTimeMillis介绍

[英]Returns the current time in milliseconds since the epoch, or a mocked out equivalent.
[中]返回自历元起的当前时间(以毫秒为单位),或模拟的等效时间。

代码示例

代码示例来源:origin: cash.bitcoinj/bitcoinj-core

/** Track a success - reset back off interval to the initial value */
public final void trackSuccess() {
  backoff = params.initial;
  retryTime = Utils.currentTimeMillis();
}

代码示例来源:origin: fr.acinq/bitcoinj-core

/** Track a success - reset back off interval to the initial value */
public final void trackSuccess() {
  backoff = params.initial;
  retryTime = Utils.currentTimeMillis();
}

代码示例来源:origin: greenaddress/GreenBits

/** Track a success - reset back off interval to the initial value */
public final void trackSuccess() {
  backoff = params.initial;
  retryTime = Utils.currentTimeMillis();
}

代码示例来源:origin: HashEngineering/dashj

/** Track a success - reset back off interval to the initial value */
public final void trackSuccess() {
  backoff = params.initial;
  retryTime = Utils.currentTimeMillis();
}

代码示例来源:origin: fr.acinq/bitcoinj-core

public PendingPing(long nonce) {
  future = SettableFuture.create();
  this.nonce = nonce;
  startTimeMsec = Utils.currentTimeMillis();
}

代码示例来源:origin: cash.bitcoinj/bitcoinj-core

/** Track a failure - multiply the back off interval by the multiplier */
public void trackFailure() {
  retryTime = Utils.currentTimeMillis() + (long)backoff;
  backoff = Math.min(backoff * params.multiplier, params.maximum);
}

代码示例来源:origin: cash.bitcoinj/bitcoinj-core

public PendingPing(long nonce) {
  future = SettableFuture.create();
  this.nonce = nonce;
  startTimeMsec = Utils.currentTimeMillis();
}

代码示例来源:origin: fr.acinq/bitcoinj-core

/** Track a failure - multiply the back off interval by the multiplier */
public void trackFailure() {
  retryTime = Utils.currentTimeMillis() + (long)backoff;
  backoff = Math.min(backoff * params.multiplier, params.maximum);
}

代码示例来源:origin: greenaddress/GreenBits

/** Track a failure - multiply the back off interval by the multiplier */
public void trackFailure() {
  retryTime = Utils.currentTimeMillis() + (long)backoff;
  backoff = Math.min(backoff * params.multiplier, params.maximum);
}

代码示例来源:origin: HashEngineering/dashj

/** Track a failure - multiply the back off interval by the multiplier */
public void trackFailure() {
  retryTime = Utils.currentTimeMillis() + (long)backoff;
  backoff = Math.min(backoff * params.multiplier, params.maximum);
}

代码示例来源:origin: fr.acinq/bitcoinj-core

/**
 * Same as {@link #addWatchedAddress(Address, long)} with the current time as the creation time.
 */
public boolean addWatchedAddress(final Address address) {
  long now = Utils.currentTimeMillis() / 1000;
  return addWatchedAddresses(Lists.newArrayList(address), now) == 1;
}

代码示例来源:origin: cash.bitcoinj/bitcoinj-core

/**
 * Same as {@link #addWatchedAddress(Address, long)} with the current time as the creation time.
 */
public boolean addWatchedAddress(final Address address) {
  long now = Utils.currentTimeMillis() / 1000;
  return addWatchedAddresses(Lists.newArrayList(address), now) == 1;
}

代码示例来源:origin: HashEngineering/dashj

/**
 * Same as {@link #addWatchedAddress(Address, long)} with the current time as the creation time.
 */
public boolean addWatchedAddress(final Address address) {
  long now = Utils.currentTimeMillis() / 1000;
  return addWatchedAddresses(Lists.newArrayList(address), now) == 1;
}

代码示例来源:origin: greenaddress/GreenBits

/**
 * Same as {@link #addWatchedAddress(Address, long)} with the current time as the creation time.
 */
public boolean addWatchedAddress(final Address address) {
  long now = Utils.currentTimeMillis() / 1000;
  return addWatchedAddresses(Lists.newArrayList(address), now) == 1;
}

代码示例来源:origin: greenaddress/GreenBits

public void complete() {
    if (!future.isDone()) {
      Long elapsed = Utils.currentTimeMillis() - startTimeMsec;
      Peer.this.addPingTimeData(elapsed);
      log.debug("{}: ping time is {} msec", Peer.this.toString(), elapsed);
      future.set(elapsed);
    }
  }
}

代码示例来源:origin: cash.bitcoinj/bitcoinj-core

public void complete() {
    if (!future.isDone()) {
      Long elapsed = Utils.currentTimeMillis() - startTimeMsec;
      Peer.this.addPingTimeData(elapsed);
      log.debug("{}: ping time is {} msec", Peer.this.toString(), elapsed);
      future.set(elapsed);
    }
  }
}

代码示例来源:origin: fr.acinq/bitcoinj-core

public void complete() {
    if (!future.isDone()) {
      Long elapsed = Utils.currentTimeMillis() - startTimeMsec;
      Peer.this.addPingTimeData(elapsed);
      log.debug("{}: ping time is {} msec", Peer.this.toString(), elapsed);
      future.set(elapsed);
    }
  }
}

代码示例来源:origin: HashEngineering/dashj

public void complete() {
    if (!future.isDone()) {
      Long elapsed = Utils.currentTimeMillis() - startTimeMsec;
      Peer.this.addPingTimeData(elapsed);
      log.debug("{}: ping time is {} msec", Peer.this.toString(), elapsed);
      future.set(elapsed);
    }
  }
}

代码示例来源:origin: greenaddress/GreenBits

@Test
public void testSuccess() {
  assertEquals(Utils.currentTimeMillis(), backoff.getRetryTime());
  backoff.trackFailure();
  backoff.trackFailure();
  backoff.trackSuccess();
  assertEquals(Utils.currentTimeMillis(), backoff.getRetryTime());
}

代码示例来源:origin: greenaddress/GreenBits

@Test
public void testFailure() {
  assertEquals(Utils.currentTimeMillis(), backoff.getRetryTime());
  backoff.trackFailure();
  backoff.trackFailure();
  backoff.trackFailure();
  assertEquals(Utils.currentTimeMillis() + 121, backoff.getRetryTime());
}

相关文章