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 Details Link icon

    • now Link icon

      public static NanoTimestamp now()
      Returns a timestamp representing the current time.
    • never Link icon

      public static NanoTimestamp never()
      Returns a timestamp from ~146 years ago, for representing the time of events that have not occurred.
      See Also:
    • isNever Link icon

      public boolean isNever()
      Returns true if this timestamp was created by never(), otherwise false.
    • compareTo Link icon

      public int compareTo(NanoTimestamp o)
      Specified by:
      compareTo in interface Comparable<NanoTimestamp>
    • elapsed Link icon

      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:
    • hasElapsed Link icon

      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 Link icon

      public Duration minus(NanoTimestamp rhs)
    • toString Link icon

      public String toString()
      Overrides:
      toString in class Object
    • equals Link icon

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode Link icon

      public int hashCode()
      Overrides:
      hashCode in class Object