Noda Time
Show / Hide Table of Contents

Class ClockExtensions

Extension methods for IClock.
Since 1.4.x
Availability netstandard2.0
Inheritance
Object
ClockExtensions
Inherited Members
Object.Equals(Object)
Object.Equals(Object, Object)
Object.GetHashCode()
Object.GetType()
Object.MemberwiseClone()
Object.ReferenceEquals(Object, Object)
Object.ToString()
Namespace: NodaTime.Extensions
Assembly: NodaTime.dll
Syntax
public static class ClockExtensions

Methods

InBclSystemDefaultZone(IClock)

Constructs a ZonedClock from a clock (the target of the method), in the wrapper for the BCL system default time zone time zone and the ISO calendar system.
Since 1.4.x
Availability netstandard2.0
Declaration
public static ZonedClock InBclSystemDefaultZone(this IClock clock)
Parameters
Type Name Description
IClock clock Clock to use in the returned object.
Returns
Type Description
ZonedClock A ZonedClock in the system default time zone and the ISO calendar system, using the system clock.
Remarks
The DateTimeZone used is a wrapper for System.TimeZoneInfo.Local.
See Also
Bcl

InTzdbSystemDefaultZone(IClock)

Constructs a ZonedClock from a clock (the target of the method), in the TZDB mapping for the system default time zone time zone and the ISO calendar system.
Since 1.4.x
Availability netstandard2.0
Declaration
public static ZonedClock InTzdbSystemDefaultZone(this IClock clock)
Parameters
Type Name Description
IClock clock Clock to use in the returned object.
Returns
Type Description
ZonedClock A ZonedClock in the system default time zone (using TZDB) and the ISO calendar system, using the system clock.
Exceptions
Type Condition
DateTimeZoneNotFoundException The system default time zone is not mapped by TZDB.
See Also
Tzdb

InUtc(IClock)

Constructs a ZonedClock from a clock (the target of the method), using the UTC time zone and ISO calendar system.
Since 1.4.x
Availability netstandard2.0
Declaration
public static ZonedClock InUtc(this IClock clock)
Parameters
Type Name Description
IClock clock Clock to use in the returned object.
Returns
Type Description
ZonedClock A ZonedClock with the given clock, in the UTC time zone and ISO calendar system.

InZone(IClock, DateTimeZone)

Constructs a ZonedClock from a clock (the target of the method), and a time zone.
Since 1.4.x
Availability netstandard2.0
Declaration
public static ZonedClock InZone(this IClock clock, DateTimeZone zone)
Parameters
Type Name Description
IClock clock Clock to use in the returned object.
DateTimeZone zone Time zone to use in the returned object.
Returns
Type Description
ZonedClock A ZonedClock with the given clock and time zone, in the ISO calendar system.

InZone(IClock, DateTimeZone, CalendarSystem)

Constructs a ZonedClock from a clock (the target of the method), a time zone, and a calendar system.
Since 1.4.x
Availability netstandard2.0
Declaration
public static ZonedClock InZone(this IClock clock, DateTimeZone zone, CalendarSystem calendar)
Parameters
Type Name Description
IClock clock Clock to use in the returned object.
DateTimeZone zone Time zone to use in the returned object.
CalendarSystem calendar Calendar to use in the returned object.
Returns
Type Description
ZonedClock A ZonedClock with the given clock, time zone and calendar system.
In this article
Back to top Generated by DocFX