Example usage for java.util.concurrent TimeUnit convert

List of usage examples for java.util.concurrent TimeUnit convert

Introduction

In this page you can find the example usage for java.util.concurrent TimeUnit convert.

Prototype

public long convert(long sourceDuration, TimeUnit sourceUnit) 

Source Link

Document

Converts the given time duration in the given unit to this unit.

Usage

From source file:com.thoughtworks.cruise.util.command.StreamPumper.java

private Long timeSinceLastLine(TimeUnit unit) {
    long now = clock.currentTimeMillis();
    return unit.convert(now - lastHeard, TimeUnit.MILLISECONDS);
}

From source file:org.apache.tinkerpop.gremlin.process.traversal.util.StandardTraversalMetrics.java

@Override
public long getDuration(final TimeUnit unit) {
    computeTotals();//  ww w.  j a  v  a 2  s  .  c  o  m
    return unit.convert(totalStepDuration, MutableMetrics.SOURCE_UNIT);
}

From source file:com.alibaba.napoli.metamorphosis.client.consumer.FetchRequest.java

@Override
public long getDelay(final TimeUnit unit) {
    return unit.convert(this.delayTimeStamp - System.currentTimeMillis(), TimeUnit.MILLISECONDS);
}

From source file:org.opennms.sms.reflector.smsservice.MobileMsgRequest.java

/** {@inheritDoc} */
@Override//from w w  w .  java  2s.  c om
public long getDelay(TimeUnit unit) {
    return unit.convert(m_expiration - System.currentTimeMillis(), TimeUnit.MILLISECONDS);
}

From source file:org.apache.tinkerpop.gremlin.process.traversal.util.DefaultTraversalMetrics.java

@Override
public long getDuration(final TimeUnit unit) {
    return unit.convert(this.totalStepDuration, MutableMetrics.SOURCE_UNIT);
}

From source file:at.alladin.rmbt.util.tools.InformationCollectorTool.java

/**
 * /*from  w w w  .j  a  v  a  2s .c  o  m*/
 * @param timeUnit
 */
public InformationCollectorTool(final TimeUnit timeUnit) {
    this(timeUnit, timeUnit.convert(DEFAULT_TIMEOUT, TimeUnit.MILLISECONDS));
}

From source file:org.panthercode.arctic.core.processing.modules.impl.Timer.java

/**
 * Returns the actual time limit.//ww  w.j a  v  a 2s .  c  om
 *
 * @param unit alternative time unit
 * @return Returns the actual time limit.
 * @throws NullPointerException Is thrown if the value of unit is null.
 */
public long getMaximalDuration(TimeUnit unit) {
    ArgumentUtils.assertNotNull(unit, "time unit");

    return unit.convert(this.getMaximalDuration(), this.timeUnit);
}

From source file:org.apache.hadoop.mapred.gridmix.GridmixJob.java

public long getDelay(TimeUnit unit) {
    return unit.convert(submissionTimeNanos - System.nanoTime(), TimeUnit.NANOSECONDS);
}

From source file:org.apache.nifi.cluster.manager.NodeResponse.java

public long getRequestDuration(final TimeUnit timeUnit) {
    return timeUnit.convert(requestDurationNanos, TimeUnit.NANOSECONDS);
}

From source file:com.piggate.sdk.Piggate.java

public static long getDateDiff(Date date1, Date date2, TimeUnit timeUnit) {
    long diffInMillies = date2.getTime() - date1.getTime();
    return timeUnit.convert(diffInMillies, TimeUnit.MILLISECONDS);
}