Interface IPrimeClock
Extends IPrimeTime with NodaTime-based "now" APIs so callers can obtain current time from the clock abstraction using NodaTime.Instant, NodaTime.LocalDateTime, NodaTime.ZonedDateTime, NodaTime.LocalTime, and NodaTime.LocalDate.
public interface IPrimeClock : IPrimeTime
- Inherited Members
- Extension Methods
Remarks
Only supported in .NET 8+. Not supported in NetStandard 2.0.
Properties
- LocalNowDate
Gets the current local date (no time component) in the system default zone.
- LocalNowDateOnly
Gets the current local date as DateOnly.
- LocalNowDateTime
Gets the current local date and time as a DateTime.
- LocalNowDateTimeOffset
Gets the current local date and time as a DateTimeOffset.
- LocalNowInstant
Gets the current local date and time (NodaTime.Instant) in the system default time zone as a NodaTime.LocalDateTime (no time zone information).
- LocalNowTime
Gets the current local time of day (no date component) in the system default zone.
- LocalNowTimeOnly
Gets the current local time-of-day as TimeOnly.
- LocalScheduleDateTimeZone
Gets the Noda NodaTime.DateTimeZone used for local calendar-day and local wall-clock time when resolving LocalZonedNowInstant and local day-time timer registration (the same zone object that backs LocalScheduleTimeZone when that property exposes a wrapped BCL zone).
- LocalScheduleTimeZone
Gets the time zone used to resolve the local calendar date and local wall-clock time for local day-time timer registration and for LocalZonedNowInstant.
- LocalZonedNowInstant
Gets the current date and time (NodaTime.Instant) in the system default time zone as a NodaTime.ZonedDateTime.
- NowInstant
Gets the current instant on the global timeline (UTC).
- UtcNowDate
Gets the current UTC date (no time component).
- UtcNowDateOnly
Gets the current UTC date as DateOnly.
- UtcNowDateTime
Gets the current UTC date and time as a DateTime.
- UtcNowDateTimeOffset
Gets the current UTC date and time as a DateTimeOffset.
- UtcNowInstant
Gets the current date and time (NodaTime.Instant) in UTC as a NodaTime.ZonedDateTime.
- UtcNowTime
Gets the current UTC time of day (no date component).
- UtcNowTimeOnly
Gets the current UTC time-of-day as TimeOnly.
- UtcZonedNowInstant
Gets the current date and time (NodaTime.Instant) in UTC as a NodaTime.ZonedDateTime. Equivalent to UtcNowInstant for symmetry with LocalZonedNowInstant.
Methods
- RegisterAsyncTimeOfDay(LocalTimeOfDay, Func<ClockTimerCallbackContext, CancellationToken, ValueTask>, CancellationToken, object?, DayTimeTimerOptions?)
Registers a local time-of-day timer with an asynchronous callback that receives timer context and cancellation token. Other
RegisterAsyncTimeOfDayoverloads for LocalTimeOfDay are provided as extension methods.
- RegisterAsyncTimeOfDay(UtcTimeOfDay, Func<ClockTimerCallbackContext, CancellationToken, ValueTask>, CancellationToken, object?, DayTimeTimerOptions?)
Registers a UTC time-of-day timer with an asynchronous callback that receives timer context and cancellation token. Other
RegisterAsyncTimeOfDayoverloads for UtcTimeOfDay are provided as extension methods.
- RegisterAsyncTimeOfDay(LocalTime, Func<ClockTimerCallbackContext, CancellationToken, ValueTask>, CancellationToken, object?, DayTimeTimerOptions?)
Registers a time-of-day timer with an asynchronous callback that receives context and cancellation token. Other NodaTime.LocalTime
RegisterAsyncTimeOfDayoverloads are extension methods.
- RegisterAsyncTimer(Duration, Duration, Func<ClockTimerCallbackContext, CancellationToken, ValueTask>, CancellationToken, object?, IntervalTimerOptions?)
Registers an interval timer with an initial delay, a repeat interval, and an asynchronous callback that receives timer context and cancellation token. Other NodaTime.Duration-based
RegisterAsyncTimeroverloads are extension methods.
- RegisterAsyncTimer(TimeSpan, TimeSpan, Func<ClockTimerCallbackContext, CancellationToken, ValueTask>, CancellationToken, object?, IntervalTimerOptions?)
Registers an interval timer with an initial delay, a repeat interval, and an asynchronous callback that receives timer context and cancellation token. Other
RegisterAsyncTimeroverloads are provided as extension methods.
- RegisterTimeOfDay(LocalTimeOfDay, Action<ClockTimerCallbackContext>, CancellationToken, object?, DayTimeTimerOptions?)
Registers a local time-of-day timer with a synchronous callback that receives timer context and optional state. Other
RegisterTimeOfDayoverloads for LocalTimeOfDay are provided as extension methods.
- RegisterTimeOfDay(UtcTimeOfDay, Action<ClockTimerCallbackContext>, CancellationToken, object?, DayTimeTimerOptions?)
Registers a UTC time-of-day timer with a synchronous callback that receives timer context and optional state. Other
RegisterTimeOfDayoverloads for UtcTimeOfDay are provided as extension methods.
- RegisterTimeOfDay(LocalTime, Action<ClockTimerCallbackContext>, CancellationToken, object?, DayTimeTimerOptions?)
Registers a time-of-day timer with a callback that receives context and state. Other NodaTime.LocalTime
RegisterTimeOfDayoverloads are extension methods.
- RegisterTimer(Duration, Duration, 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 NodaTime.Duration-based
RegisterTimeroverloads are extension methods.
- 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
RegisterTimeroverloads are provided as extension methods.