Condividi tramite


IInstantSource.Offset(IInstantSource, Duration) Method

Definition

Obtains a source that returns instants from the specified source with the specified duration added.

[Android.Runtime.Register("offset", "(Ljava/time/InstantSource;Ljava/time/Duration;)Ljava/time/InstantSource;", "", ApiSince=34)]
public static Java.Time.IInstantSource? Offset (Java.Time.IInstantSource? baseSource, Java.Time.Duration? offsetDuration);
[<Android.Runtime.Register("offset", "(Ljava/time/InstantSource;Ljava/time/Duration;)Ljava/time/InstantSource;", "", ApiSince=34)>]
static member Offset : Java.Time.IInstantSource * Java.Time.Duration -> Java.Time.IInstantSource

Parameters

baseSource
IInstantSource

the base source to add the duration to, not null

offsetDuration
Duration

the duration to add, not null

Returns

a source based on the base source with the duration added, not null

Attributes

Remarks

Obtains a source that returns instants from the specified source with the specified duration added.

This source wraps another source, returning instants that are later by the specified duration. If the duration is negative, the instants will be earlier than the current date and time. The main use case for this is to simulate running in the future or in the past.

A duration of zero would have no offsetting effect. Passing zero will return the underlying source.

The returned implementation is immutable, thread-safe and Serializable providing that the base source is.

Java documentation for java.time.InstantSource.offset(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.

Applies to