Clock.Tick(Clock, Duration) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Obtains a clock that returns instants from the specified clock truncated to the nearest occurrence of the specified duration.
[Android.Runtime.Register("tick", "(Ljava/time/Clock;Ljava/time/Duration;)Ljava/time/Clock;", "", ApiSince=26)]
public static Java.Time.Clock? Tick(Java.Time.Clock? baseClock, Java.Time.Duration? tickDuration);
[<Android.Runtime.Register("tick", "(Ljava/time/Clock;Ljava/time/Duration;)Ljava/time/Clock;", "", ApiSince=26)>]
static member Tick : Java.Time.Clock * Java.Time.Duration -> Java.Time.Clock
Parameters
- baseClock
- Clock
the base clock to base the ticking clock on, not null
- tickDuration
- Duration
the duration of each visible tick, not negative, not null
Returns
a clock that ticks in whole units of the duration, not null
- Attributes
Remarks
Obtains a clock that returns instants from the specified clock truncated to the nearest occurrence of the specified duration. This clock will only tick as per the specified duration. Thus, if the duration is half a second, the clock will return instants truncated to the half second. The tick duration must be positive. If it has a part smaller than a whole millisecond, then the whole duration must divide into one second without leaving a remainder. All normal tick durations will match these criteria, including any multiple of hours, minutes, seconds and milliseconds, and sensible nanosecond durations, such as 20ns, 250,000ns and 500,000ns. A duration of zero or one nanosecond would have no truncation effect. Passing one of these will return the underlying clock. Implementations may use a caching strategy for performance reasons. As such, it is possible that the start of the requested duration observed via this clock will be later than that observed directly via the underlying clock. The returned implementation is immutable, thread-safe and Serializable providing that the base clock is.
Java reference for java.time.Clock.tick.