Interface TimeProvider

Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface @AvailableSince("0.0.25") public interface TimeProvider
  • Method Summary

    Modifier and Type
    Method
    Description
    Create a TimeProvider using the system time
    create(Clock clock)
    Create a TimeProvider using the given clock
    long
    Get the current time in milliseconds
  • Method Details

    • create

      static TimeProvider create(Clock clock)
      Create a TimeProvider using the given clock
      Parameters:
      clock - clock instance
      Returns:
      TimeProvider instance
      See Also:
    • create

      static TimeProvider create()
      Create a TimeProvider using the system time
      Returns:
      TimeProvider instance
    • getTime

      long getTime()
      Get the current time in milliseconds
      Returns:
      current time in milliseconds