Clock.Fixed(Instant, ZoneId) 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 always returns the same instant.
[Android.Runtime.Register("fixed", "(Ljava/time/Instant;Ljava/time/ZoneId;)Ljava/time/Clock;", "", ApiSince=26)]
public static Java.Time.Clock? Fixed(Java.Time.Instant? fixedInstant, Java.Time.ZoneId? zone);
[<Android.Runtime.Register("fixed", "(Ljava/time/Instant;Ljava/time/ZoneId;)Ljava/time/Clock;", "", ApiSince=26)>]
static member Fixed : Java.Time.Instant * Java.Time.ZoneId -> Java.Time.Clock
Parameters
- fixedInstant
- Instant
the instant to use as the clock, not null
- zone
- ZoneId
the time-zone to use to convert the instant to date-time, not null
Returns
a clock that always returns the same instant, not null
- Attributes
Remarks
Obtains a clock that always returns the same instant. This clock simply returns the specified instant. As such, it is not a clock in the conventional sense. The main use case for this is in testing, where the fixed clock ensures tests are not dependent on the current clock. The returned implementation is immutable, thread-safe and Serializable.
Java reference for java.time.Clock.fixed.