com.streambase.sb

## Interface TimeService

-     public interface TimeService

  This interface defines a contract that enables users to provide custom implementations of time used by StreamBase server It must be implemented by all Time Service classes.
  Since:
    7.4

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `advanceBy(long timeAdvance, TimeUnit timeUnit)` Advances the service time by a certain number of time units in the future.
    `void` | `advanceTo(long targetTimeMsec)` Make the service advance to a specific time in the future
    `Timestamp` | `getFutureTimestamp(long targetAdvance, TimeUnit timeUnit)` Get the time stamp of a time point based on the specific time advance
    `long` | `getTargetTime()` Get the current time in milliseconds from the perspective of this time service

- - ### Method Detail

    - #### getTargetTime

          long getTargetTime()

      Get the current time in milliseconds from the perspective of this time service
      Returns:
        the current time in milliseconds

    - #### advanceBy

          void advanceBy(long timeAdvance,
                         TimeUnit timeUnit)
                  throws StreamBaseException

      Advances the service time by a certain number of time units in the future.
      Parameters:
        `timeAdvance` - number of time units that the service should advance by. It should be a positive long value
        `timeUnit` - time unit
      Throws:
        `StreamBaseException`

    - #### advanceTo

          void advanceTo(long targetTimeMsec)
                  throws StreamBaseException

      Make the service advance to a specific time in the future
      Parameters:
        `targetTimeMsec` - Time to advance to. It must be greater than the service's current time
      Throws:
        `StreamBaseException`

    - #### getFutureTimestamp

          Timestamp getFutureTimestamp(long targetAdvance,
                                       TimeUnit timeUnit)

      Get the time stamp of a time point based on the specific time advance
      Parameters:
        `targetAdvance` - time difference (in time units) between the future time point and the service's current time It must be 0 or a positive value
        `timeUnit` - time unit
      Returns:
        a time stamp

Copyright © 2015–2018 Cloud Software Group, Inc.. All rights reserved.