org.xbib.metrics.common.UserTimeClock Maven / Gradle / Ivy
package org.xbib.metrics.common;
import org.xbib.metrics.api.Clock;
/**
* A clock implementation which returns the current time in epoch nanoseconds.
*/
class UserTimeClock implements Clock {
/**
* The default clock to use.
*
* @return the default {@link Clock} instance
* @see UserTimeClock
*/
static Clock defaultClock() {
return UserTimeClock.DEFAULT;
}
static final Clock DEFAULT = new UserTimeClock();
@Override
public long getTick() {
return System.nanoTime();
}
@Override
public long getTime() {
return System.currentTimeMillis();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy