Daily Dotnet - Your bite-sized update of .NET, C#, and Azure

Ankit Kashyap

Published On

2023-06-10

Daily Archives
  • dotnet-fundamentals
  • dotnet

TimeProvider - Time abstraction

We got a new abstract class TimeProvider (here is the proposal doc for it - API to provide the current system time #36617, originally proposed - Too many ISystemClock definitions #16844)
As the proposal says
👉
This abstraction will include the ability to retrieve the system date and time, either in UTC or local time, as well as timestamps for use in performance or tagging scenarios.
 
There are many implementations around this (Around 7 of ISystemClock implementations, ITimer, and sometimes by developers), and it was a good idea to move them out and make a single common implementation.
Here is a cool video from Nick Chapsas on this 🙏
 
Video preview
 
BTW, They made it work on down-level supported versions of both .NET and .NET Core - by creating a netstandard 2.0 library called Microsoft.Bcl.TimeProvider.
 
Read more:

Not a daily person? Subscribe the weekly newsletter

Made with 💖 in Beautiful British Columbia 🍁