Class TimeBucketExtensions

Namespace
Cratis.Chronicle.Concepts.Patterns
Assembly
Cratis.Chronicle.dll

Extension methods for working out the TimeBucket a moment falls in.

public static class TimeBucketExtensions
Inheritance
TimeBucketExtensions
Inherited Members

Remarks

This lives with the concept rather than beside the miner because both sides of the wire need it and need to agree. The engine buckets an event's Occurred when it mines; anything asking what usually happens at a given moment has to bucket that moment the same way, or it asks about a slot the mining never used. A caller left to write the branching itself gets one chance to write it differently, and the mismatch is silent - the query simply returns nothing.

Methods

ToTimeBucket(DateTimeOffset)

Gets the TimeBucket a moment falls in.

public static TimeBucket ToTimeBucket(this DateTimeOffset moment)

Parameters

moment DateTimeOffset

The moment to bucket.

Returns

TimeBucket

The TimeBucket.

Remarks

Read from the offset the moment carries, not from UTC. Somebody who works at nine in the morning does so at nine in their own morning, and normalizing to UTC first would scatter that one behavior across buckets as they travel or as daylight saving shifts.