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

com.unit16.z.time.GMTMicros Maven / Gradle / Ivy

package com.unit16.z.time;

import java.util.Comparator;

public interface GMTMicros {

    public long gmtMicros();

    public static final class Const extends NicelyFormatted
    {
        private final long ts_;
        public Const(long t) { ts_ = t; }

        @Override
        public long gmtMicros() { return ts_; }
    }

    static abstract class NicelyFormatted implements GMTMicros
    {
        @Override
        public String toString()
        {
            final long micros = gmtMicros() % 1000;
            return DateUtils.fromMicros(this).toString() + "." + micros;
        }
    }

    public static final Comparator ORDERING = (GMTMicros o1, GMTMicros o2) -> {
        final long dl = o1.gmtMicros() - o2.gmtMicros();
        return Long.signum(dl);
    };
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy