Early Preview
This is currently very much a preview. Please feel free to try things out,
but don't be upset if anything is not yet working. Feedback is welcome over on our
GitHub Dicussions page.
interface NodaTime.​IClock
Assembly: NodaTime
Represents a clock which can return the current time as an <see cref="T:NodaTime.Instant" /> .
Remarks
<see cref="T:NodaTime.IClock" /> is intended for use anywhere you need to have access to the current time.
Although it's not strictly incorrect to call <c>SystemClock.Instance.GetCurrentInstant()</c> directly,
in the same way as you might call <see cref="P:System.DateTime.UtcNow" /> , it's strongly discouraged
as a matter of style for production code. We recommend providing an instance of <see cref="T:NodaTime.IClock" />
to anything that needs it, which allows you to write tests using the fake clock in the NodaTime.Testing
assembly (or your own implementation).
Methods
GetCurrentInstant​()
Gets the current <see cref="T:NodaTime.Instant" /> on the time line according to this clock.
Returns The current instant on the time line according to this clock.