Table of Contents

PrimeTime (NodaTime) examples

Self-contained snippets for the KZDev.PrimeTime stack, the NodaTime superset that ships Instant, Duration, LocalTime, LocalDate, and ZonedDateTime APIs on top of the BCL surfaces. Each page shows code copied directly from the in-repo example projects:

  • Production demos live in Source/Dev/Production/KZDev.PrimeTime.Examples/.
  • Test demos live in Source/Dev/Testing/KZDev.PrimeTime.Testing.Examples/ and use xUnit with AwesomeAssertions.

Production

  • Interval timers — register sync and async interval callbacks on IPrimeClock using NodaTime Duration.
  • Time-of-day and DST — register local LocalTime callbacks, plus environment-aware skipped/ambiguous handling and the clock's LocalScheduleTimeZone.
  • DI registration — what AddPrimeClock registers and how to resolve the abstractions, including the NodaTime IClock.
  • "Now" surfaces — the NodaTime-first projections (NowInstant, LocalZonedNowInstant, LocalNowTime, LocalNowDate, etc.).
  • Persistence and conversions (production) — project persisted Instant values into the schedule zone; LocalTimeOfDay round-trip; delay TimeSpan clamping.
  • Sleep, delay, and cancellationSleep, DelayAsync, and time-based cancellation tokens, all expressed with Duration.

Testing (virtual time)

Cross-track testing examples

The following pages cover patterns shared by both stacks; both are presented side-by-side: