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

com.ringcentral.platform.metrics.utils.SystemTimeMsProvider Maven / Gradle / Ivy

package com.ringcentral.platform.metrics.utils;

import static com.ringcentral.platform.metrics.utils.TimeUnitUtils.NANOS_PER_MS;
import static java.lang.System.*;

public class SystemTimeMsProvider implements TimeMsProvider {

    public static final SystemTimeMsProvider INSTANCE = new SystemTimeMsProvider();

    final long initialTimeNanos = nanoTime();

    @Override
    public long timeMs() {
        return currentTimeMillis();
    }

    @Override
    public long stableTimeMs() {
        return (nanoTime() - initialTimeNanos) / NANOS_PER_MS;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy