class Utils {

    public static long getNowMicrosUtc() {
        long now = System.currentTimeMillis() * 1000;
        long time = previousTimeValue.getAndIncrement();

        // Only set time if current time is greater than our stored time.
        if (now > time) {
            // This CAS can fail; getAndIncrement() ensures no value is returned twice.
            previousTimeValue.compareAndSet(time + 1, now);
            return previousTimeValue.getAndIncrement();
        } else if (time - now > timeDriftThresholdMicros) {
            throw new IllegalStateException("Time drift is " + (time - now));
        }

        return time;
    }

    private  Utils();

}