List of usage examples for java.util.concurrent TimeUnit convert
public long convert(long sourceDuration, TimeUnit sourceUnit)
From source file:gmjonker.util.Stopwatch.java
/** * Returns the current elapsed time shown on this stopwatch, expressed in the desired time unit, * with any fraction rounded down.//from w ww . ja v a 2 s . c o m * <p> * <p>Note that the overhead of measurement can be more than a microsecond, so it is generally not * useful to specify {@link TimeUnit#NANOSECONDS} precision here. * * @since 14.0 (since 10.0 as {@code elapsedTime()}) */ public long elapsed(TimeUnit desiredUnit) { return desiredUnit.convert(elapsedNanos(), NANOSECONDS); }
From source file:org.apache.accumulo.core.client.BatchWriterConfig.java
public long getMaxLatency(TimeUnit timeUnit) { return timeUnit.convert(maxLatency != null ? maxLatency : DEFAULT_MAX_LATENCY, TimeUnit.MILLISECONDS); }
From source file:org.apache.accumulo.core.client.BatchWriterConfig.java
public long getTimeout(TimeUnit timeUnit) { return timeUnit.convert(timeout != null ? timeout : DEFAULT_TIMEOUT, TimeUnit.MILLISECONDS); }
From source file:org.apache.falcon.notification.service.request.DataNotificationRequest.java
@Override public long getDelay(TimeUnit unit) { if (isFirst) { this.isFirst = false; return 0; }/*w w w . j a v a 2s .co m*/ long age = System.currentTimeMillis() - accessTimeInMillis; return unit.convert(pollingFrequencyInMillis - age, TimeUnit.MILLISECONDS); }
From source file:io.horizondb.model.core.fields.TimestampField.java
/** * {@inheritDoc}/*from ww w . j a va 2 s . co m*/ */ @Override public long getTimestampIn(TimeUnit unit) { return unit.convert(this.sourceTimestamp, this.sourceUnit); }
From source file:org.apache.hadoop.hbase.client.RawAsyncTableImpl.java
@Override public long getReadRpcTimeout(TimeUnit unit) { return unit.convert(readRpcTimeoutNs, TimeUnit.NANOSECONDS); }
From source file:org.apache.hadoop.hbase.client.RawAsyncTableImpl.java
@Override public long getWriteRpcTimeout(TimeUnit unit) { return unit.convert(writeRpcTimeoutNs, TimeUnit.NANOSECONDS); }
From source file:org.apache.hadoop.hbase.client.RawAsyncTableImpl.java
@Override public long getOperationTimeout(TimeUnit unit) { return unit.convert(operationTimeoutNs, TimeUnit.NANOSECONDS); }
From source file:org.panthercode.arctic.core.processing.modules.impl.Repeater.java
/** * Returns the actual delay time the object is associated with. * * @param unit own time unit/*from ww w . j av a 2 s . c om*/ * @return Returns the actual delay time the object is associated with. * @throws NullPointerException */ public long getDelayTime(final TimeUnit unit) { ArgumentUtils.assertNotNull(timeUnit, "timeUnit"); return unit.convert(this.options.getDelayTime(), this.timeUnit); }
From source file:eu.europa.esig.dss.DSSUtils.java
/** * Gets a difference between two dates/*from w ww . j a va 2s . c o m*/ * * @param date1 * the oldest date * @param date2 * the newest date * @param timeUnit * the unit in which you want the diff * @return the difference value, in the provided unit */ public static long getDateDiff(final Date date1, final Date date2, final TimeUnit timeUnit) { long diff = date2.getTime() - date1.getTime(); return timeUnit.convert(diff, TimeUnit.MILLISECONDS); }