Class FixedClockProvider

java.lang.Object
org.midheaven.time.FixedClockProvider
All Implemented Interfaces:
ClockProvider

public class FixedClockProvider extends Object implements ClockProvider
Provides a Clock fixed at a given instant
  • Method Details

    • newInstance

      public static FixedClockProvider newInstance(ZonedDateTime dateTime)
      Created a FixedClockProvider fixed at a given instant
      Parameters:
      dateTime - the fixed instant as a ZonedDateTime
      Returns:
      the resulting provider
    • newInstanceAtUtc

      public static FixedClockProvider newInstanceAtUtc(LocalDateTime dateTime)
      Created a FixedClockProvider fixed at a given instant
      Parameters:
      dateTime - the fixed instant as a LocalDateTime in UTC
      Returns:
      the resulting provider
    • newInstance

      public static FixedClockProvider newInstance(LocalDateTime dateTime, ZoneId zoneId)
      Created a FixedClockProvider fixed at a given instant in a given zoneId
      Parameters:
      dateTime - the fixed instant as a LocalDateTime ar the given zoneId
      zoneId - the reference ZoneId
      Returns:
      the resulting provider
    • newInstance

      public static FixedClockProvider newInstance(Instant instant, ZoneId zoneId)
      Created a FixedClockProvider fixed at a given instant in a given zoneId
      Parameters:
      instant - the fixed instant
      zoneId - the reference ZoneId
      Returns:
      the resulting provider
    • clock

      public Clock clock()
      Returns the reference Clock
      Specified by:
      clock in interface ClockProvider
      Returns: