PrimeTime is a .NET library family for injectable clocks, deterministic test time, and timer registration—including interval timers and, on modern frameworks, local time-of-day schedules with explicit daylight-saving behavior.
This repository builds four NuGet packages. It ships two production packages and two testing packages that share one design but differ by namespace, dependencies, and API surface. Use only one production package per application.
Do not reference both production packages in the same app. Use one testing package per test project, matched to your production package. See Testing packages for install, DI, and examples.
# NodaTime superset
dotnet add package KZDev.PrimeTime
# BCL / TimeProvider only
dotnet add package KZDev.SystemClock.PrimeTimeAll four packages target net10.0, net8.0, and netstandard2.0 (with BCL polyfills on netstandard2.0 where required). The netstandard2.0 binaries support .NET Framework 4.8.1 and later consumers via the standard compatibility surface.
| Area | What is covered |
|---|---|
| Shipped package TFMs | net10.0, net8.0, netstandard2.0 (unchanged across all four packages) |
| CI-validated | Unit and integration tests on net8.0 and net10.0 on ubuntu-latest (ci.yml) |
| .NET Framework / net481 | Package consumption via netstandard2.0 is supported; repository test projects also target net481, but that TFM is not exercised in CI. Validate on Windows locally (Visual Studio, ReSharper, or the xUnit v3 .exe runner — see Local net481 testing). |
This matrix is best-effort for .NET Framework: there is no Windows CI job and no guarantee of automated net481 regression coverage on every change.
Each package exposes AddPrimeClock on IServiceCollection:
- KZDev.PrimeTime registers
NodaTime.IClock(defaultSystemClock.Instance), thenIPrimeClock→PrimeClock, andIPrimeTime→ the same instance. - KZDev.SystemClock.PrimeTime registers
TimeProvider(defaultTimeProvider.System), thenIPrimeClock→PrimeClock, andIPrimeTime→ the same instance.
Hosted docs : kzdev-net.github.io/kzdev.primetime
- Support and lifecycle policy: SUPPORT.md (best-effort support, no SLA, versioning expectations).
- Security disclosures: SECURITY.md (public GitHub Issues accepted; optional private advisory).
- Contributing: CONTRIBUTING.md (external PRs not accepted; Issues and Discussions welcome).
- Per-package release notes (source for NuGet
PackageReleaseNotes): - Index : Release notes.
- SemVer compatibility: Breaking API changes are intended for major version bumps only; minor/patch updates are expected to remain compatible.
- Per-package lifecycle: The latest published
major.minorfor each package line is the primary maintenance focus, including both production and testing packages. - Older package lines: Backports to older lines are best-effort and not guaranteed; plan upgrades to current package lines.
- Cadence expectation: Releases are need-driven (no fixed schedule). Change details and compatibility implications are published in each package release-notes file.
IPrimeClock/PrimeClock— production clock; timer registration and “now” projections (exact members depend on package and TFM).- Testing packages — virtual time for tests (
IPrimeTestClock/PrimeTestClock) is provided byKZDev.PrimeTime.TestingorKZDev.SystemClock.PrimeTime.Testing. - Day-time timers —
SkippedTimeBehaviorandDuplicateTimeBehavioronDayTimeTimerOptionsfor local wall-clock scheduling near DST transitions (see docs). ToTimeProvider— adapt anIPrimeClocktoTimeProviderfor interoperability.
- Source: github.com/kzdev-net/kzdev.primetime
- License: MIT
- Governance: SECURITY.md, CONTRIBUTING.md
External pull requests are not accepted. Use GitHub Issues and Discussions as described in CONTRIBUTING.md and SUPPORT.md.