Table of Contents

Class ITimeServiceExtensions

Namespace
Acuit.Pinpoint.Timing
Assembly
Acuit.Pinpoint.Timing.Abstractions.dll

Extension methods for ITimeService.

public static class ITimeServiceExtensions
Inheritance
ITimeServiceExtensions
Inherited Members

Methods

DelayAsync(ITimeService, int)

Creates a task that completes after a specified time interval.

public static Task DelayAsync(this ITimeService timeService, int millisecondsDelay)

Parameters

timeService ITimeService

The ITimeService.

millisecondsDelay int

The number of milliseconds to wait before completing the returned task, or -1 to wait indefinitely.

Returns

Task

A task that represents the time delay.

Exceptions

ArgumentNullException

timeService is null.

ArgumentOutOfRangeException

millisecondsDelay is a negative value other than -1, or it represents a time span that is greater than MaxDelay.

DelayAsync(ITimeService, int, CancellationToken)

Creates a cancellable task that completes after a specified time interval.

public static Task DelayAsync(this ITimeService timeService, int millisecondsDelay, CancellationToken cancellationToken)

Parameters

timeService ITimeService

The ITimeService.

millisecondsDelay int

The number of milliseconds to wait before completing the returned task, or -1 to wait indefinitely.

cancellationToken CancellationToken

The cancellation token that will be checked prior to completing the returned task.

Returns

Task

A task that represents the time delay.

Exceptions

ArgumentNullException

timeService is null.

ArgumentOutOfRangeException

millisecondsDelay is a negative value other than -1, or it represents a time span that is greater than MaxDelay.

StartNewTimeoutTimer(ITimeService, TimeSpan)

Initializes a new timeout timer instance and starts measuring elapsed time.

public static ITimeoutTimer StartNewTimeoutTimer(this ITimeService timeService, TimeSpan duration)

Parameters

timeService ITimeService

The ITimeService.

duration TimeSpan

The timeout duration.

Returns

ITimeoutTimer

A ITimeoutTimer that has just begun measuring elapsed time.

Exceptions

ArgumentNullException

timeService is null.

ArgumentOutOfRangeException

duration is greater than MaxDelay or represents a negative time interval.