This interface primarily exists for testing purposes, allowing test code to
isolate itself from the system clock. In production, theSystemClockimplementation 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 toInstance.
Methods
GetCurrentDateTimeUtc()
DateTime GetCurrentDateTimeUtc()
Returns the current date and time in UTC, with a kind ofUtc.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-04 UTC."],[[["\u003cp\u003eThis page provides documentation for the \u003ccode\u003eIClock\u003c/code\u003e interface, which abstracts the ability to determine the current date and time.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eIClock\u003c/code\u003e interface is primarily used for testing, allowing isolation from the system clock, with \u003ccode\u003eSystemClock\u003c/code\u003e being the most common implementation in production.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eIClock\u003c/code\u003e interface resides within the \u003ccode\u003eGoogle.Api.Gax\u003c/code\u003e namespace, in the \u003ccode\u003eGoogle.Api.Gax.dll\u003c/code\u003e assembly.\u003c/p\u003e\n"],["\u003cp\u003eThe interface contains one method, \u003ccode\u003eGetCurrentDateTimeUtc()\u003c/code\u003e, which returns the current date and time in UTC.\u003c/p\u003e\n"],["\u003cp\u003eMultiple versions of the \u003ccode\u003eIClock\u003c/code\u003e interface are accessible, ranging from version 3.2.0 up to the latest, 4.10.0.\u003c/p\u003e\n"]]],[],null,[]]