Table of Contents

Method RegisterTimer

Namespace
KZDev.SystemClock.PrimeTime
Assembly
KZDev.SystemClock.PrimeTime.dll

RegisterTimer(TimeSpan, TimeSpan, Action<ClockTimerCallbackContext>, CancellationToken, object?, IntervalTimerOptions?)

Registers an interval timer with an initial delay, a repeat interval, and a synchronous callback that receives timer context. Other RegisterTimer overloads are provided as extension methods.

IClockIntervalTimer RegisterTimer(TimeSpan callbackTime, TimeSpan repeatInterval, Action<ClockTimerCallbackContext> callback, CancellationToken cancellationToken, object? state = null, IntervalTimerOptions? timerOptions = null)

Parameters

callbackTime TimeSpan

Time until the first callback.

repeatInterval TimeSpan

Interval for subsequent callbacks; InfiniteTimeSpan for one-shot.

callback Action<ClockTimerCallbackContext>

The callback invoked when the timer fires; receives timer context.

cancellationToken CancellationToken

Token that participates in cancelling the timer registration; pass None when no external cancellation is required.

state object

Optional state passed to the callback via ClockTimerCallbackContext.

timerOptions IntervalTimerOptions

Optional timer options.

Returns

IClockIntervalTimer

An IClockIntervalTimer to monitor or change the timer.