Skip to content

com.hypercubetools.timeslip / TimeSlip / startAt

startAt

@JvmStatic @JvmOverloads fun startAt(initialInstant:Instant, zone:ZoneId= DEFAULT_ZONE, tickAmount:Duration= ONE_SECOND):TimeSlip

Create an instance that starts at a given time, but moves forward by a constant amount each time the current time is requested.

Parameters

initialInstant - The time the instance is initially set to.

zone - The time-zone the instance should be based in. Defaults to UTC.

tickAmount - The amount of time that should be added to the previous time to calculate the current time. If desired, a negative value can be used to move the time backwards instead of forwards.

Return A newly constructed instance.

@JvmStatic @JvmOverloads fun startAt(initialInstant:Instant, zone:ZoneId= DEFAULT_ZONE, tickForward:TickForward):TimeSlip

Create an instance that starts at a given time, but changes based on a given function each time the current time is requested.

Parameters

initialInstant - The time the instance is initially set to.

zone - The time-zone the instance should be based in. Defaults to UTC.

tickForward - A function that specifies how the clock's time should change when the time is requested. This is called immediately after a value is requested. So when the first time is requested, this function will be called to to pre-load the next time to return. This should be considered if this function has any side effects.

Return A newly constructed instance.