Method RegisterTimeOfDay
RegisterTimeOfDay(IPrimeClock, LocalTimeOfDay, Action<ClockTimerCallbackContext, CancellationToken>, CancellationToken, object?, DayTimeTimerOptions?)
Registers a time-of-day timer with a callback that receives context and cancellation token.
public static IClockDayTimeTimer RegisterTimeOfDay(this IPrimeClock clock, LocalTimeOfDay timeOfDay, Action<ClockTimerCallbackContext, CancellationToken> callback, CancellationToken cancellationToken, object? state = null, DayTimeTimerOptions? timerOptions = null)
Parameters
clockIPrimeClocktimeOfDayLocalTimeOfDayThe local time of day at which to fire.
callbackAction<ClockTimerCallbackContext, CancellationToken>The callback invoked when the timer fires; receives timer context and a cancellation token.
cancellationTokenCancellationTokenToken that participates in cancelling the timer registration; pass None when no external cancellation is required.
stateobjectOptional state passed to the callback via ClockTimerCallbackContext.
timerOptionsDayTimeTimerOptionsOptional day-time timer options.
Returns
- IClockDayTimeTimer
An IClockDayTimeTimer to monitor or change the timer.
Remarks
Only supported in .NET 8+. Not supported in NetStandard 2.0.
RegisterTimeOfDay(IPrimeClock, LocalTimeOfDay, Action, CancellationToken, DayTimeTimerOptions?)
Registers a time-of-day timer that fires at the given local time each day (sync callback).
public static IClockDayTimeTimer RegisterTimeOfDay(this IPrimeClock clock, LocalTimeOfDay timeOfDay, Action callback, CancellationToken cancellationToken, DayTimeTimerOptions? timerOptions = null)
Parameters
clockIPrimeClocktimeOfDayLocalTimeOfDayThe local time of day at which to fire.
callbackActionThe callback to run when the timer fires.
cancellationTokenCancellationTokenToken that participates in cancelling the timer registration; pass None when no external cancellation is required.
timerOptionsDayTimeTimerOptionsOptional day-time timer options.
Returns
- IClockDayTimeTimer
An IClockDayTimeTimer to monitor or change the timer.
Remarks
Only supported in .NET 8+. Not supported in NetStandard 2.0.
RegisterTimeOfDay(IPrimeClock, UtcTimeOfDay, Action<ClockTimerCallbackContext, CancellationToken>, CancellationToken, object?, DayTimeTimerOptions?)
Registers a UTC time-of-day timer with a callback that receives context and cancellation token.
public static IClockDayTimeTimer RegisterTimeOfDay(this IPrimeClock clock, UtcTimeOfDay timeOfDay, Action<ClockTimerCallbackContext, CancellationToken> callback, CancellationToken cancellationToken, object? state = null, DayTimeTimerOptions? timerOptions = null)
Parameters
clockIPrimeClocktimeOfDayUtcTimeOfDayThe UTC time of day at which to fire.
callbackAction<ClockTimerCallbackContext, CancellationToken>The callback invoked when the timer fires; receives timer context and a cancellation token.
cancellationTokenCancellationTokenToken that participates in cancelling the timer registration; pass None when no external cancellation is required.
stateobjectOptional state passed to the callback via ClockTimerCallbackContext.
timerOptionsDayTimeTimerOptionsOptional day-time timer options.
Returns
- IClockDayTimeTimer
An IClockDayTimeTimer to monitor or change the timer.
Remarks
Only supported in .NET 8+. Not supported in NetStandard 2.0.
RegisterTimeOfDay(IPrimeClock, UtcTimeOfDay, Action, CancellationToken, DayTimeTimerOptions?)
Registers a time-of-day timer that fires at the given UTC time each day (sync callback).
public static IClockDayTimeTimer RegisterTimeOfDay(this IPrimeClock clock, UtcTimeOfDay timeOfDay, Action callback, CancellationToken cancellationToken, DayTimeTimerOptions? timerOptions = null)
Parameters
clockIPrimeClocktimeOfDayUtcTimeOfDayThe UTC time of day at which to fire.
callbackActionThe callback to run when the timer fires.
cancellationTokenCancellationTokenToken that participates in cancelling the timer registration; pass None when no external cancellation is required.
timerOptionsDayTimeTimerOptionsOptional day-time timer options.
Returns
- IClockDayTimeTimer
An IClockDayTimeTimer to monitor or change the timer.
Remarks
Only supported in .NET 8+. Not supported in NetStandard 2.0.