class TimeProvider {

    private static final AtomicLong lastTimeHolder = new AtomicLong();
    private static LongSupplier millisecondSupplier = System::currentTimeMillis;

    private TimeProvider() {
    }

    /**
     * Returns a non-decreasing number, assumed to be used as a "timestamp".
     * <p>
     * Approximate system time interval between two calls of this method is retrievable via
     * {@link #systemTimeIntervalBetween(long, long, TimeUnit)}, applied to the returned values
     * from those {@code currentTime()} calls.
     * <p>
     * Safe and scalable for concurrent use from multiple threads.
     *
     * @return the current timestamp
     */
    public static long currentTime() {
        long now = MILLISECONDS.toNanos(millisecondSupplier.getAsLong());
        while (true) {
            long lastTime = lastTimeHolder.get();
            if (now <= lastTime)
                return lastTime;
            if (lastTimeHolder.compareAndSet(lastTime, now))
                return now;
            Jvm.nanoPause();
        }
    }

    /**
     * Returns system time interval (i. e. wall time interval) between two time values, taken using
     * {@link #currentTime()} method, with the highest possible precision, in the given time units.
     *
     * @param earlierTime            {@link #currentTime()} result, taken at some moment in the past (earlier)
     * @param laterTime              {@link #currentTime()} result, taken at some moment in the past, but later
     *                               than {@code earlierTime} was taken ("later" means there is a happens-before relationship
     *                               between the two subject {@code currentTime()} calls)
     * @param systemTimeIntervalUnit the time units to return system time interval in
     * @return wall time interval between the specified moments in the given time unit
     */
    public static long systemTimeIntervalBetween(
            long earlierTime, long laterTime, TimeUnit systemTimeIntervalUnit) {<FILL_FUNCTION_BODY>}

    static void overrideMillisecondSupplier(final LongSupplier millisecondSupplier) {
        TimeProvider.millisecondSupplier = millisecondSupplier;
    }
}

        long intervalNanos = laterTime - earlierTime;
        return systemTimeIntervalUnit.convert(intervalNanos, NANOSECONDS);
    
<no_super_class>