Noda Time
Show / Hide Table of Contents

Class ZonedClock

A clock with an associated time zone and calendar. This is effectively a convenience class decorating an IClock.
Since 1.4.x
Availability net45, netstandard1.3
Inheritance
Object
ZonedClock
Implements
IClock
Inherited Members
Object.ToString()
Object.Equals(Object)
Object.Equals(Object, Object)
Object.ReferenceEquals(Object, Object)
Object.GetHashCode()
Object.GetType()
Object.MemberwiseClone()
Namespace: NodaTime
Assembly: NodaTime.dll
Syntax
public sealed class ZonedClock : IClock

Constructors

ZonedClock(IClock, DateTimeZone, CalendarSystem)

Creates a new ZonedClock with the given clock, time zone and calendar system.
Since 1.4.x
Availability net45, netstandard1.3
Declaration
public ZonedClock(IClock clock, DateTimeZone zone, CalendarSystem calendar)
Parameters
Type Name Description
IClock clock Clock to use to obtain instants.
DateTimeZone zone Time zone to adjust instants into.
CalendarSystem calendar Calendar system to use.
Exceptions
Type Condition
ArgumentNullException clock, zone or calendar is null

Methods

GetCurrentDate()

Returns the local date of the current instant provided by the underlying clock, adjusted to the time zone of this object.
Since 1.4.x
Availability net45, netstandard1.3
Declaration
public LocalDate GetCurrentDate()
Returns
Type Description
LocalDate The local date of the current instant provided by the underlying clock, adjusted to the time zone of this object.

GetCurrentInstant()

Returns the current instant provided by the underlying clock.
Since 1.4.x
Availability net45, netstandard1.3
Declaration
public Instant GetCurrentInstant()
Returns
Type Description
Instant The current instant provided by the underlying clock.

GetCurrentLocalDateTime()

Returns the local date/time of the current instant provided by the underlying clock, adjusted to the time zone of this object.
Since 1.4.x
Availability net45, netstandard1.3
Declaration
public LocalDateTime GetCurrentLocalDateTime()
Returns
Type Description
LocalDateTime The local date/time of the current instant provided by the underlying clock, adjusted to the time zone of this object.

GetCurrentOffsetDateTime()

Returns the offset date/time of the current instant provided by the underlying clock, adjusted to the time zone of this object.
Since 1.4.x
Availability net45, netstandard1.3
Declaration
public OffsetDateTime GetCurrentOffsetDateTime()
Returns
Type Description
OffsetDateTime The offset date/time of the current instant provided by the underlying clock, adjusted to the time zone of this object.

GetCurrentTimeOfDay()

Returns the local time of the current instant provided by the underlying clock, adjusted to the time zone of this object.
Since 1.4.x
Availability net45, netstandard1.3
Declaration
public LocalTime GetCurrentTimeOfDay()
Returns
Type Description
LocalTime The local time of the current instant provided by the underlying clock, adjusted to the time zone of this object.

GetCurrentZonedDateTime()

Returns the current instant provided by the underlying clock, adjusted to the time zone of this object.
Since 1.4.x
Availability net45, netstandard1.3
Declaration
public ZonedDateTime GetCurrentZonedDateTime()
Returns
Type Description
ZonedDateTime The current instant provided by the underlying clock, adjusted to the time zone of this object.

Implements

IClock

Extension Methods

ClockExtensions.InZone(IClock, DateTimeZone)
ClockExtensions.InZone(IClock, DateTimeZone, CalendarSystem)
ClockExtensions.InUtc(IClock)
ClockExtensions.InTzdbSystemDefaultZone(IClock)
ClockExtensions.InBclSystemDefaultZone(IClock)
In this article
Back to top Generated by DocFX