Skip to content

Commit b8a52ca

Browse files
committed
feat: override ManualTimeProvider.ToString, returns GetUtcNow date time string
1 parent 537d1e1 commit b8a52ca

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1111
- Changed ManualTestProvider sets the local time zone to UTC by default, provides method for overriding during testing.
1212
- Changed `ManualTestProvider` sets the local time zone to UTC by default, provides method for overriding during testing.
1313

14+
- Changed `ManualTestProvider.ToString()` method to return current date time.
1415
## [1.0.0-preview.1]
1516

1617
This release adds a dependency on [Microsoft.Bcl.TimeProvider](https://www.nuget.org/packages/Microsoft.Bcl.TimeProvider) and utilizes the types built-in to that to do much of the work.

src/TimeProviderExtensions/ManualTimeProvider.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,13 @@ public void SetUtcNow(DateTimeOffset newUtcNew)
210210
}
211211
}
212212

213+
/// <summary>
214+
/// Returns a string representation this clock's current time.
215+
/// </summary>
216+
/// <returns>A string representing the clock's current time.</returns>
217+
public override string ToString()
218+
=> GetUtcNow().ToString("yyyy-MM-ddTHH:mm:ss.fff", CultureInfo.InvariantCulture);
219+
213220
private void ScheduleCallback(ManualTimer timer, TimeSpan waitTime)
214221
{
215222
lock (futureCallbacks)

0 commit comments

Comments
 (0)