Table of Contents

Method ToTimeProvider

Namespace
KZDev.PrimeTime
Assembly
KZDev.PrimeTime.dll

ToTimeProvider(IPrimeClock)

Returns a TimeProvider that uses the given PrimeTime clock for GetUtcNow(), GetLocalNow(), and CreateTimer(TimerCallback, object, TimeSpan, TimeSpan).

public static TimeProvider ToTimeProvider(this IPrimeClock clock)

Parameters

clock IPrimeClock

The PrimeTime clock (e.g. KZDev.PrimeTime.PrimeClock or a test-clock implementation from the matching PrimeTime.Testing package).

Returns

TimeProvider

A TimeProvider backed by clock. When clock is a test clock, advancing virtual time with its Advance(TimeSpan) or RunFor(TimeSpan) operations drives the returned provider's time and timers deterministically.

Exceptions

ArgumentNullException

clock is null.