Skip to content

Latest commit

 

History

History
36 lines (29 loc) · 1.24 KB

README.md

File metadata and controls

36 lines (29 loc) · 1.24 KB

Travis Build Coverage Status

monotonic-timestamp

Monotonically increasing timestamp.
Since System.currentTimeMillis as ms, if you call it twice quickly, it's possible to get two identical time stamps.
This class fixes the problem!

The Timestamp is so lightweight, you can create one Timestamp instance for each signal source.
But you only has one signal source, just use the static method Timestamp.timestamp() directly.

Timestamp can generate 262144 unique timestamp in one milli-second.
Max valid timestamp: Fri Dec 12 20:41:28 CST 3084

dependency

gradle

implementation "com.zmannotes:monotonic-timestamp:0.0.6"

maven

<dependency>
    <groupId>com.zmannotes</groupId>
    <artifactId>monotonic-timestamp</artifactId>
    <version>0.0.5</version>
</dependency>

How to use

import com.zman.monotonic.timestamp.Timestamp;

...

long uniqueTimestamp = Timestamp.uniq();