Noda Time
Show / Hide Table of Contents

Class SystemClock

Singleton implementation of IClock which reads the current system time. It is recommended that for anything other than throwaway code, this is only referenced in a single place in your code: where you provide a value to inject into the rest of your application, which should only depend on the interface.
Since 1.0.x
Availability net45, netstandard1.3
Inheritance
Object
SystemClock
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 SystemClock : IClock

Properties

Instance

The singleton instance of SystemClock.
Since 1.0.x
Availability net45, netstandard1.3
Declaration
public static SystemClock Instance { get; }
Property Value
Type Description
SystemClock The singleton instance of SystemClock.

Methods

GetCurrentInstant()

Gets the current time as an Instant.
Since 2.0.x
Availability net45, netstandard1.3
Declaration
public Instant GetCurrentInstant()
Returns
Type Description
Instant The current time in ticks as an Instant.

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