All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.xbib.metrics.common.UserTimeClock Maven / Gradle / Ivy

There is a newer version: 2.1.0
Show newest version
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