Skip to content

Commit

Permalink
Feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
adegeo committed Dec 10, 2024
1 parent 113ebae commit 3cfb62b
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
2 changes: 1 addition & 1 deletion docs/standard/datetime/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ The following classes to support working with time:

For .NET Framework and .NET Standard, `TimeProvider` is provided by the [**Microsoft.Bcl.TimeProvider** NuGet package](https://www.nuget.org/packages/Microsoft.Bcl.TimeProvider/).

The following classes to support working with time:
The following classes to support working with dates:

* <xref:System.DateOnly>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ public static void SendGreeting(TimeProvider currentTime, string name)

if (localTime.Date.Month == MoonLandingDateTime.Date.Month
&& localTime.Date.Day == MoonLandingDateTime.Date.Day)
{
Console.WriteLine("Did you know that on this day in 1969 humans landed on the Moon?");

}

Console.WriteLine($"I hope you enjoy your day!");
}
}
Expand Down
15 changes: 15 additions & 0 deletions docs/standard/datetime/timeprovider-overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,21 @@ And unit tests can be written to test specific scenarios, such as testing the an

Starting with .NET 8, the <xref:System.TimeProvider> class is provided by the runtime library. Older versions of .NET or libraries targeting .NET Standard 2.0, must reference the [**Microsoft.Bcl.TimeProvider** NuGet package](https://www.nuget.org/packages/Microsoft.Bcl.TimeProvider/).

The following methods related to asynchronous programming work with `TimeProvider`:

- <xref:System.Threading.CancellationTokenSource.%23ctor(System.TimeSpan,System.TimeProvider)>
- <xref:System.Threading.Tasks.Task.Delay(System.TimeSpan,System.TimeProvider)?displayProperty=nameWithType>
- <xref:System.Threading.Tasks.Task.Delay(System.TimeSpan,System.TimeProvider,System.Threading.CancellationToken)?displayProperty=nameWithType>
- <xref:System.Threading.Tasks.Task.WaitAsync(System.TimeSpan,System.TimeProvider)?displayProperty=nameWithType>
- <xref:System.Threading.Tasks.Task.WaitAsync(System.TimeSpan,System.TimeProvider,System.Threading.CancellationToken)?displayProperty=nameWithType>

## Use with .NET Framework

<xref:System.TimeProvider> is implemented by the [**Microsoft.Bcl.TimeProvider** NuGet package](https://www.nuget.org/packages/Microsoft.Bcl.TimeProvider/).

Support for working with `TimeProvider` in asynchronous programming scenarios was added through the following extension methods:

- <xref:System.Threading.Tasks.TimeProviderTaskExtensions.CreateCancellationTokenSource(System.TimeProvider,System.TimeSpan)?displayProperty=nameWithType>
- <xref:System.Threading.Tasks.TimeProviderTaskExtensions.Delay(System.TimeProvider,System.TimeSpan,System.Threading.CancellationToken)?displayProperty=nameWithType>
- <xref:System.Threading.Tasks.TimeProviderTaskExtensions.WaitAsync(System.Threading.Tasks.Task,System.TimeSpan,System.TimeProvider,System.Threading.CancellationToken)?displayProperty=nameWithType>
- <xref:System.Threading.Tasks.TimeProviderTaskExtensions.WaitAsync``1(System.Threading.Tasks.Task{``0},System.TimeSpan,System.TimeProvider,System.Threading.CancellationToken)?displayProperty=nameWithType>

0 comments on commit 3cfb62b

Please sign in to comment.