Package com.couchbase.client.core.util
Class NanoTimestamp
- java.lang.Object
-
- com.couchbase.client.core.util.NanoTimestamp
-
- All Implemented Interfaces:
Comparable<NanoTimestamp>
@Internal public class NanoTimestamp extends Object implements Comparable<NanoTimestamp>
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(NanoTimestamp o)Durationelapsed()Returns the time elapsed since this timestamp was created.booleanequals(Object o)booleanhasElapsed(Duration d)Returns true if the time elapsed since this timestamp was created is greater than or equal to the given duration, otherwise false.inthashCode()booleanisNever()Returns true if this timestamp was created bynever(), otherwise false.Durationminus(NanoTimestamp rhs)static NanoTimestampnever()Returns a timestamp from ~146 years ago, for representing the time of events that have not occurred.static NanoTimestampnow()Returns a timestamp representing the current time.StringtoString()
-
-
-
Method Detail
-
now
public static NanoTimestamp now()
Returns a timestamp representing the current time.
-
never
public static NanoTimestamp never()
Returns a timestamp from ~146 years ago, for representing the time of events that have not occurred.- See Also:
isNever()
-
isNever
public boolean isNever()
Returns true if this timestamp was created bynever(), otherwise false.
-
compareTo
public int compareTo(NanoTimestamp o)
- Specified by:
compareToin interfaceComparable<NanoTimestamp>
-
elapsed
public Duration elapsed()
Returns the time elapsed since this timestamp was created.NOTE: If this timestamp is
never(), the returned value will be at least 146 years.- See Also:
isNever()
-
hasElapsed
public boolean hasElapsed(Duration d)
Returns true if the time elapsed since this timestamp was created is greater than or equal to the given duration, otherwise false.If this timestamp is
never(), this method returns true for all "reasonable" durations (less than ~146 years).
-
minus
public Duration minus(NanoTimestamp rhs)
-
-