Skip to content

VirtualClock class

Attributes: [DebuggerDisplay("{DebuggerDisplay,nq}")]

Defined in

Namespace: ReactiveUI.Primitives.Concurrency Assembly: ReactiveUI.Primitives.dll Full name: ReactiveUI.Primitives.Concurrency.VirtualClock Modifiers: public sealed

Summary

View source

Deterministic virtual scheduler backed by DateTimeOffset and TimeSpan.

Applies to

net10.0, net10.0-android36.0, net10.0-ios26.0, net10.0-macos26.0, net10.0-tvos26.0, net10.0-maccatalyst26.0, net10.0-browserwasm1.0, net10.0-desktop1.0, net9.0, net9.0-desktop1.0, net9.0-browserwasm1.0, net8.0, net8.0-ios17.5, net8.0-maccatalyst17.5, net8.0-macos14.2, net8.0-macos14.5, net8.0-tvos17.2, netstandard2.1, net481, net471, net462

Class hierarchy
classDiagram
class VirtualClock
class ISequencer {
    <>
}
ISequencer <|.. VirtualClock
class IServiceProvider {
    <>
}
IServiceProvider <|.. VirtualClock
class IStopwatchProvider {
    <>
}
IStopwatchProvider <|.. VirtualClock

Implements: ISequencer, IServiceProvider, IStopwatchProvider

Constructors

NameSummary
.ctorInitializes a new instance of the [VirtualClock](# class at the default clock value.

Properties

NameSummary
ClockGets the scheduler's absolute time clock value.
IsEnabledGets a value indicating whether the scheduler is enabled to run work.
NowGets the scheduler's notion of current time.
TimestampGets the sequencer's monotonic timestamp.

Methods

NameSummary
AdvanceByAdvances the scheduler's clock by the specified relative time, running all work scheduled for that timespan.
AdvanceToAdvances the scheduler's clock to the specified time, running all work till that point.
SleepAdvances the scheduler's clock by the specified relative time without running work.
StartStarts the virtual time scheduler.
StopStops the virtual time scheduler.
ScheduleSchedules a work item for execution as soon as possible.
ScheduleAbsoluteSchedules an action to be executed at an absolute due time.
ScheduleRelativeSchedules an action to be executed after a relative due time.
StartStopwatchStarts a new stopwatch object.
Inherited members

Extension members