This interface primarily exists for testing purposes, allowing test code to
isolate itself from the system clock. In production, the SystemClock
implementation is by far the most likely one to be used, and the only one provided
within this library. Code that uses a clock should generally be designed to allow it
to be optionally specified, defaulting to Instance.
Methods
GetCurrentDateTimeUtc()
DateTime GetCurrentDateTimeUtc()
Returns the current date and time in UTC, with a kind of Utc.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[[["\u003cp\u003eThe \u003ccode\u003eIClock\u003c/code\u003e interface provides an abstraction for determining the current date and time, primarily for testing purposes to isolate code from the system clock.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eSystemClock\u003c/code\u003e implementation, which is the default, is most commonly used in production environments and is the only one provided in this library.\u003c/p\u003e\n"],["\u003cp\u003eCode utilizing a clock should allow for optional specification, defaulting to the \u003ccode\u003eInstance\u003c/code\u003e property of \u003ccode\u003eSystemClock\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eGetCurrentDateTimeUtc()\u003c/code\u003e method of the \u003ccode\u003eIClock\u003c/code\u003e interface returns the current date and time in UTC format, using a \u003ccode\u003eDateTime\u003c/code\u003e type.\u003c/p\u003e\n"],["\u003cp\u003eThe different versions of the interface can be accessed via the different links, with 4.10.0 being the latest.\u003c/p\u003e\n"]]],[],null,[]]