Class RelativeTime

java.lang.Object
com.gigaspaces.time.RelativeTime
All Implemented Interfaces:
ITimeProvider

public final class RelativeTime extends Object implements ITimeProvider
ITimeProvider implementation specifying a precise timer, which is not influenced by motions of the wall-clock time.

Returns the current value of the running Java Virtual Machine's high-resolution time source, converted from nanoseconds to milliseconds. This method timeMillis() can only be used to measure elapsed time and is not related to any other notion of system or wall-clock time. The value returned represents milliseconds since some fixed but arbitrary origin time (perhaps in the future, so values may be negative). The same origin is used by all invocations of this method in an instance of a Java virtual machine; other virtual machine instances are likely to use a different origin.

  • Constructor Details

    • RelativeTime

      public RelativeTime()
      Returns a RelativeTime instance based on nanosecond precision.
  • Method Details

    • timeMillis

      public long timeMillis()
      Returns the current value of the most precise available system timer, in milliseconds. This method is used to measure elapsed time and is not related to any other notion of system or wall-clock time.
      Specified by:
      timeMillis in interface ITimeProvider
      Returns:
      The current value of the system timer, in milliseconds.
    • isRelative

      public boolean isRelative()
      Specified by:
      isRelative in interface ITimeProvider