IInstantSource.Tick(IInstantSource, 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 source that returns instants from the specified source truncated to the nearest occurrence of the specified duration.
[Android.Runtime.Register("tick", "(Ljava/time/InstantSource;Ljava/time/Duration;)Ljava/time/InstantSource;", "", ApiSince=34)]
public static Java.Time.IInstantSource? Tick (Java.Time.IInstantSource? baseSource, Java.Time.Duration? tickDuration);
[<Android.Runtime.Register("tick", "(Ljava/time/InstantSource;Ljava/time/Duration;)Ljava/time/InstantSource;", "", ApiSince=34)>]
static member Tick : Java.Time.IInstantSource * Java.Time.Duration -> Java.Time.IInstantSource
Parameters
- baseSource
- IInstantSource
the base source to base the ticking source on, not null
- tickDuration
- Duration
the duration of each visible tick, not negative, not null
Returns
a source that ticks in whole units of the duration, not null
- Attributes
Remarks
Obtains a source that returns instants from the specified source truncated to the nearest occurrence of the specified duration.
This source will only tick as per the specified duration. Thus, if the duration is half a second, the source 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 source.
Implementations may use a caching strategy for performance reasons. As such, it is possible that the start of the requested duration observed via this source will be later than that observed directly via the underlying source.
The returned implementation is immutable, thread-safe and Serializable
providing that the base source is.
Java documentation for java.time.InstantSource.tick(java.time.InstantSource, java.time.Duration)
.
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.