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

zmq.util.Clock Maven / Gradle / Ivy

There is a newer version: 0.6.0
Show newest version
package zmq.util;

import java.util.concurrent.TimeUnit;

public class Clock
{
    //  TSC timestamp of when last time measurement was made.
    // private long last_tsc;

    //  Physical time corresponding to the TSC above (in milliseconds).
    // private long last_time;

    private Clock()
    {
    }

    //  High precision timestamp.
    public static long nowUS()
    {
        return TimeUnit.MICROSECONDS.convert(System.nanoTime(), TimeUnit.NANOSECONDS);
    }

    //  Low precision timestamp. In tight loops generating it can be
    //  10 to 100 times faster than the high precision timestamp.
    public static long nowMS()
    {
        return System.currentTimeMillis();
    }

    //  CPU's timestamp counter. Returns 0 if it's not available.
    public static long rdtsc()
    {
        return 0;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy