Class PreciseZonedClock
Represents a precise provider of ZonedDateTime instances.
public sealed class PreciseZonedClock : ZonedClockBase, IZonedClock, IGenerator<ZonedDateTime>, IGenerator
- Inheritance
-
PreciseZonedClock
- Implements
- Inherited Members
- Extension Methods
Constructors
PreciseZonedClock(TimeZoneInfo)
Creates a new PreciseZonedClock instance with default PrecisionResetTimeout equal to 1 minute.
public PreciseZonedClock(TimeZoneInfo timeZone)
Parameters
timeZone
TimeZoneInfoTime zone of this clock.
PreciseZonedClock(TimeZoneInfo, Duration)
Creates a new PreciseZonedClock instance.
public PreciseZonedClock(TimeZoneInfo timeZone, Duration precisionResetTimeout)
Parameters
timeZone
TimeZoneInfoTime zone of this clock.
precisionResetTimeout
DurationPrecision reset timeout. See PrecisionResetTimeout for more information.
Exceptions
- ArgumentOutOfRangeException
When
precisionResetTimeout
is less than 1 tick.
Fields
Local
PreciseZonedClock instance that returns ZonedDateTime instances in the Local time zone, with PrecisionResetTimeout equal to 1 minute.
public static readonly PreciseZonedClock Local
Field Value
Utc
PreciseZonedClock instance that returns ZonedDateTime instances in the Utc time zone, with PrecisionResetTimeout equal to 1 minute.
public static readonly PreciseZonedClock Utc
Field Value
Properties
PrecisionResetTimeout
Represents a reset timeout for the period of precise ZonedDateTime computation. After this period ends, the next returned ZonedDateTime instance will not use the underlying Stopwatch for improved precision and a new timeout will start.
public Duration PrecisionResetTimeout { get; }
Property Value
Methods
GetNow()
Returns the current ZonedDateTime.
public override ZonedDateTime GetNow()
Returns
- ZonedDateTime
Current ZonedDateTime.