METHOD
TimeProvider.GetElapsedTime
Converts two timestamps from the same provider into an elapsed duration. Use this instead of subtracting wall-clock dates to measure a local retry budget.
Formal Syntax & Structure
csharp syntaxcsharp
clock.GetElapsedTime(start,end)Working Example
Example Snippetcsharp
using System;using System.Collections.Generic;using System.Threading;using System.Threading.Tasks;using System.Threading.Channels;var clock=TimeProvider.System; long start=clock.GetTimestamp(); Console.WriteLine(clock.GetElapsedTime(start,start)==TimeSpan.Zero); // True