Skip to content

kzdev-net/kzdev.primetime

Repository files navigation

KZDev PrimeTime

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.

Packages

Package Namespace Stack NuGet
KZDev.PrimeTime KZDev.PrimeTime NodaTime supersetInstant, Duration, LocalTime, zoned “now”, NodaTime timer overloads on IPrimeClock. NuGet
KZDev.SystemClock.PrimeTime KZDev.SystemClock.PrimeTime BCL subsetTimeProvider, DateTimeOffset / TimeSpan, no NodaTime. NuGet
KZDev.PrimeTime.Testing KZDev.PrimeTime TestingIPrimeTestClock / PrimeTestClock for deterministic tests; pair with KZDev.PrimeTime. NuGet
KZDev.SystemClock.PrimeTime.Testing KZDev.SystemClock.PrimeTime Testing — virtual time for tests; pair with KZDev.SystemClock.PrimeTime. NuGet

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.

Quick install

# NodaTime superset
dotnet add package KZDev.PrimeTime

# BCL / TimeProvider only
dotnet add package KZDev.SystemClock.PrimeTime

Target frameworks

All 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.

Supported platforms and test coverage

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.

Dependency injection (same entry point name, different assembly)

Each package exposes AddPrimeClock on IServiceCollection:

  • KZDev.PrimeTime registers NodaTime.IClock (default SystemClock.Instance), then IPrimeClockPrimeClock, and IPrimeTime → the same instance.
  • KZDev.SystemClock.PrimeTime registers TimeProvider (default TimeProvider.System), then IPrimeClockPrimeClock, and IPrimeTime → the same instance.

Documentation

Hosted docs : kzdev-net.github.io/kzdev.primetime

Support, lifecycle, security, and contributing

Compatibility and maintenance cadence

  • 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.minor for 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.

Features (high level)

  • 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 by KZDev.PrimeTime.Testing or KZDev.SystemClock.PrimeTime.Testing.
  • Day-time timersSkippedTimeBehavior and DuplicateTimeBehavior on DayTimeTimerOptions for local wall-clock scheduling near DST transitions (see docs).
  • ToTimeProvider — adapt an IPrimeClock to TimeProvider for interoperability.

Repository and license

Contributing

External pull requests are not accepted. Use GitHub Issues and Discussions as described in CONTRIBUTING.md and SUPPORT.md.

About

Repository for the 'KZDev.PrimeTime' and 'KZDev.SystemClock.PrimeTime' time management libraries. PrimeTime is a .NET library family for injectable clocks, deterministic test time, and timer registration.

Topics

Resources

License

Contributing

Security policy

Stars

Watchers

Forks

Contributors

Languages