com.rt.storage.api.client.util.NanoClock Maven / Gradle / Ivy
package com.rt.storage.api.client.util;
/**
* Nano clock which can be used to measure elapsed time in nanoseconds.
*
* The default system implementation can be accessed at {@link #SYSTEM}. Alternative
* implementations may be used for testing.
*
* @since 1.14
* @author Yaniv Inbar
*/
public interface NanoClock {
/**
* Returns the current value of the most precise available system timer, in nanoseconds for use to
* measure elapsed time, to match the behavior of {@link System#nanoTime()}.
*/
long nanoTime();
/**
* Provides the default System implementation of a nano clock by using {@link System#nanoTime()}.
*/
NanoClock SYSTEM =
new NanoClock() {
public long nanoTime() {
return System.nanoTime();
}
};
}