Interface TimeSource

    • Method Detail

      • currentTimeMillis

        long currentTimeMillis()
        Returns:
        the current time in milliseconds
      • nanoTime

        long nanoTime()
        Returns:
        Returns the current time value in nanoseconds.

        This method can only be used to measure elapsed time and is not related to any other notion of system or wall-clock time.

      • sleepUninterruptibly

        TimeSource sleepUninterruptibly​(long sleepFor,
                                        java.util.concurrent.TimeUnit unit)
        Sleep for the given amount of time uninterruptibly.
        Parameters:
        sleepFor - given amout.
        unit - time unit
        Returns:
        The time source itself after the given sleep period.
      • sleep

        TimeSource sleep​(long sleepFor,
                         java.util.concurrent.TimeUnit unit)
                  throws java.lang.InterruptedException
        Sleep for the given amount of time. This operation could interrupted. Hence after returning from this method, it is not guaranteed that the request amount of time has passed.
        Parameters:
        sleepFor - given amout.
        unit - time unit
        Returns:
        The time source itself after the given sleep period.
        Throws:
        java.lang.InterruptedException