Class ClockExtensions
Extension methods for IClock.
Since 1.4.x
Availability net35-Client, PCL
Inheritance
Object
ClockExtensions
Inherited Members
Object.ToString()
Object.Equals(Object)
Object.Equals(Object, Object)
Object.ReferenceEquals(Object, Object)
Object.GetHashCode()
Object.GetType()
Object.MemberwiseClone()
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 net35-Client
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. (The value returned is never null.) |
Remarks
The
DateTimeZone
used is a wrapper for System.TimeZoneInfo.Local.Exceptions
Type | Condition |
---|---|
ArgumentNullException | clock is null. |
See Also
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 net35-Client, PCL
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. (The value returned is never null.) |
Exceptions
Type | Condition |
---|---|
DateTimeZoneNotFoundException | The system default time zone is not mapped by TZDB. |
ArgumentNullException | clock is null. |
See Also
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 net35-Client, PCL
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. (The value returned is never null.) |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | clock is null. |
InZone(IClock, DateTimeZone)
Constructs a ZonedClock from a clock (the target of the method),
and a time zone.
Since 1.4.x
Availability net35-Client, PCL
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. (The value returned is never null.) |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | clock or zone is null |
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 net35-Client, PCL
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. (The value returned is never null.) |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | clock, zone or calendar is null |