You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We've added a useful feature called TimeProvider.GetElapsedTime(long startingTimestamp, long endingTimestamp). However, we've identified another frequently used scenario where users want to calculate the elapsed time from the starting timestamp to the current timestamp. To achieve this, users must currently call:
To simplify this process, we propose introducing an overload for GetElapsedTime that allows users to simply call timeProvider.GetElapsedTime(startingTimestamp) without having to manually call GetTimestamp() each time they want to calculate the elapsed time.
namespaceSystem{publicabstractclassTimeProvider{/// <summary>/// Gets the elapsed time since the <paramref name="startingTimestamp"/> value retrieved using <see cref="GetTimestamp"/>./// </summary>publicTimeSpanGetElapsedTime(longstartingTimestamp)}}
API Usage
longstartingTimestamp=timeProvider.GetTimeStamp();// .... do some work hereTimeSpantimeProvider.GetElapsedTime(startingTimestamp);
namespaceSystem{publicpartialclassTimeProvider{/// <summary>/// Gets the elapsed time since the <paramref name="startingTimestamp"/> value retrieved using <see cref="GetTimestamp"/>./// </summary>publicTimeSpanGetElapsedTime(longstartingTimestamp)}}
Activity
tarekgh commentedon Apr 17, 2023
CC @sebastienros @stephentoub
bartonjs commentedon Apr 18, 2023
Video
Looks good as proposed