Table of Contents

Class EpochAnchoredPeriod

Namespace
MailFathom.Domain.Scheduling
Assembly
MailFathom.Domain.dll

Places an instant in the fixed window of a given length that the Unix epoch anchors.

public static class EpochAnchoredPeriod
Inheritance
EpochAnchoredPeriod
Inherited Members

Remarks

Anchoring at the epoch is what lets every process of a deployment, and every restart of one, agree on where a period begins without anything having to be stored to say so: a boundary is a function of the clock and the period alone.

The division is floored rather than truncated, so an instant before the epoch — which no clock this runs on reports, but which a test may hand it — lands on the start of its period rather than on the end of the one before.

JobRecurrence deliberately does not use this, and is not a fifth caller waiting to be folded in. It truncates instead, and answers null for the latest occurrence and -1 for the index of an instant before the epoch rather than placing it in a period at all; its own tests pin both.

Methods

EndAt(TimeSpan, DateTimeOffset)

Finds when the period an instant falls in rolls over.

StartAt(TimeSpan, DateTimeOffset)

Finds the start of the period an instant falls in.