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 netstandard2.0
Inheritance
Object
SystemClock
Implements
Inherited Members
Object.Equals(Object)
Object.Equals(Object, Object)
Object.GetHashCode()
Object.GetType()
Object.MemberwiseClone()
Object.ReferenceEquals(Object, Object)
Object.ToString()
Namespace: NodaTime
Assembly: NodaTime.dll
Syntax
public sealed class SystemClock : IClock
Properties
Instance
The singleton instance of SystemClock.
Since 1.0.x
Availability netstandard2.0
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 netstandard2.0
Declaration
public Instant GetCurrentInstant()
Returns
Type | Description |
---|---|
Instant | The current time in ticks as an Instant. |