FakeTimeProvider Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Represents a synthetic time provider that can be used to enable deterministic behavior in tests.
public ref class FakeTimeProvider : TimeProvider
public class FakeTimeProvider : TimeProvider
type FakeTimeProvider = class
inherit TimeProvider
Public Class FakeTimeProvider
Inherits TimeProvider
- Inheritance
Constructors
FakeTimeProvider() |
Initializes a new instance of the FakeTimeProvider class. |
FakeTimeProvider(DateTimeOffset) |
Initializes a new instance of the FakeTimeProvider class. |
Properties
AutoAdvanceAmount |
Gets or sets the amount of time by which time advances whenever the clock is read. |
LocalTimeZone |
Gets the local time zone according to this TimeProvider's notion of time. |
Start |
Gets the starting date and time for this provider. |
TimestampFrequency |
Gets the amount by which the value from GetTimestamp() increments per second. |
Methods
AdjustTime(DateTimeOffset) |
Advances the date and time in the UTC time zone. |
Advance(TimeSpan) |
Advances time by a specific amount. |
CreateTimer(TimerCallback, Object, TimeSpan, TimeSpan) |
Creates a new ITimer instance, using TimeSpan values to measure time intervals. |
Equals(Object) |
Determines whether the specified object is equal to the current object. (Inherited from Object) |
GetElapsedTime(Int64) |
Gets the elapsed time since the |
GetElapsedTime(Int64, Int64) |
Gets the elapsed time between two timestamps retrieved using GetTimestamp(). (Inherited from TimeProvider) |
GetHashCode() |
Serves as the default hash function. (Inherited from Object) |
GetLocalNow() |
Gets the current date and time according to this TimeProvider's notion of time based on GetUtcNow(), with the offset set to the LocalTimeZone's offset from Coordinated Universal Time (UTC). (Inherited from TimeProvider) |
GetTimestamp() |
Gets the current high-frequency value designed to measure small time intervals with high accuracy in the timer mechanism. |
GetType() |
Gets the Type of the current instance. (Inherited from Object) |
GetUtcNow() |
Gets the current Coordinated Universal Time (UTC) date and time with an offset of zero, according to this TimeProvider's notion of time. |
MemberwiseClone() |
Creates a shallow copy of the current Object. (Inherited from Object) |
SetLocalTimeZone(TimeZoneInfo) |
Sets the local time zone. |
SetUtcNow(DateTimeOffset) |
Advances the date and time in the UTC time zone. |
ToString() |
Returns a string representation this provider's idea of current time. |
Extension Methods
CreateCancellationTokenSource(TimeProvider, TimeSpan) | |
Delay(TimeProvider, TimeSpan, CancellationToken) |
Applies to
.NET
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기