Interface IClock
Abstraction over monotonic time providers (Environment.TickCount64, Stopwatch.GetTimestamp, as opposed to DateTime).
Namespace: Yarp.ReverseProxy.Utilities
Assembly: Yarp.ReverseProxy.dll
Syntax
public interface IClock
Properties
| Improve this Doc View SourceTickCount
Gets a value that indicates the current tick count measured as milliseconds from an arbitrary reference time.
The default implementation leverages
Declaration
long TickCount { get; }
Property Value
Type | Description |
---|---|
System.Int64 |
Methods
| Improve this Doc View SourceDelay(Int32, CancellationToken)
Creates a cancellable task that completes after a specified time interval.
This is equivalent to
Declaration
Task Delay(int millisecondsDelay, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | millisecondsDelay | The number of milliseconds to wait before completing the returned task, or -1 to wait indefinitely. |
CancellationToken | cancellationToken | A cancellation token to observe while waiting for the task to complete. |
Returns
Type | Description |
---|---|
Task | A task that represents the time delay. |
Delay(TimeSpan, CancellationToken)
Creates a cancellable task that completes after a specified time interval.
This is equivalent to
Declaration
Task Delay(TimeSpan delay, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
TimeSpan | delay | The time span to wait before completing the returned task, or TimeSpan.FromMilliseconds(-1) to wait indefinitely. |
CancellationToken | cancellationToken | A cancellation token to observe while waiting for the task to complete. |
Returns
Type | Description |
---|---|
Task | A task that represents the time delay. |
GetStopwatchTime()
Gets a precise time measurement using
Declaration
TimeSpan GetStopwatchTime()
Returns
Type | Description |
---|---|
TimeSpan | The time measurement. |
GetUtcNow()
Gets the current time in UTC as a
Declaration
DateTimeOffset GetUtcNow()
Returns
Type | Description |
---|---|
DateTimeOffset |