Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
docs: add note about TimeProvider in readme
  • Loading branch information
feO2x committed Mar 25, 2025
commit ffd028e4a8343f1bfe50b32158f6224e39b05fa9
2 changes: 2 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,8 @@ Light.SharedCore also offers you the `FloatParser` and the `DecimalParser`. Furt

## Abstract from DateTime.UtcNow by using IClock

> While .NET 8 introduced the `TimeProvider` class, we think that this API is too verbose (including its timer functionality). This is why we stick to the `IClock` interface of Light.SharedCore and promote using it.

Light.SharedCore provides the `IClock` interface that abstracts calls to `DateTime.Now` and `DateTime.UtcNow`. This is usually required when testing your code, and you want to supply dedicated `DateTime` values to better control your tests. `IClock` has a method called `GetTime` that you can use to obtain the current time stamp.

There are three implementations for `IClock`:
Expand Down