Table of Contents

Class ZonedDateTimeGenerator

Namespace
Hegel.Temporal
Assembly
Hegel.dll

Draws date-times in time zones, shrinking toward 2000-01-01T00:00 in UTC. The engine draws the zone, then a wall-clock time in it, and reads that time against the zone source: one draw in twenty on average lands on or beside one of the zone's transitions, which is how skipped and repeated times are reached. See ZonedDateTimes() for how bad arguments are reported.

public sealed class ZonedDateTimeGenerator : ValueGenerator<ZonedDateTime>
Inheritance
ZonedDateTimeGenerator
Inherited Members

Methods

AllowImaginary(bool)

Whether wall-clock times the clocks skipped are drawn (they are not by default). One is reported with Skipped, the offset in force after the clocks changed, and the instant its wall clock reads with the offset before.

public ZonedDateTimeGenerator AllowImaginary(bool allow)

Parameters

allow bool

Returns

ZonedDateTimeGenerator

Ambiguous(Ambiguous)

Which instant a repeated wall-clock time means: by default either, shrinking to the earlier.

public ZonedDateTimeGenerator Ambiguous(Ambiguous ambiguous)

Parameters

ambiguous Ambiguous

Returns

ZonedDateTimeGenerator

Exceptions

ArgumentException

ambiguous is not a policy.

DoDraw(TestCase)

Draw one value. Called inside a span labelled Label: draw from another generator through DrawSilent<T>(Generator<T>), which opens its span, rather than by calling its hook.

protected override ZonedDateTime DoDraw(TestCase tc)

Parameters

tc TestCase

Returns

ZonedDateTime

Max(DateTime)

A wall-clock time no later than max, in whichever zone is drawn.

public ZonedDateTimeGenerator Max(DateTime max)

Parameters

max DateTime

Returns

ZonedDateTimeGenerator

Exceptions

ArgumentException

max is not of Unspecified; the instant is bounded too, and only one of the two can be; or the settings given so far allow no value.

Max(DateTimeOffset)

An instant no later than max.

public ZonedDateTimeGenerator Max(DateTimeOffset max)

Parameters

max DateTimeOffset

Returns

ZonedDateTimeGenerator

Exceptions

ArgumentException

The wall-clock time is bounded too, and only one of the two can be; or the settings given so far allow no value.

Min(DateTime)

A wall-clock time no earlier than min, in whichever zone is drawn.

public ZonedDateTimeGenerator Min(DateTime min)

Parameters

min DateTime

Returns

ZonedDateTimeGenerator

Exceptions

ArgumentException

min is not of Unspecified; the instant is bounded too, and only one of the two can be; or the settings given so far allow no value.

Min(DateTimeOffset)

An instant no earlier than min.

public ZonedDateTimeGenerator Min(DateTimeOffset min)

Parameters

min DateTimeOffset

Returns

ZonedDateTimeGenerator

Exceptions

ArgumentException

The wall-clock time is bounded too, and only one of the two can be; or the settings given so far allow no value.

Precision(Precision)

Only wall-clock times of day that are whole numbers of precision since midnight, rather than of ticks.

public ZonedDateTimeGenerator Precision(Precision precision)

Parameters

precision Precision

Returns

ZonedDateTimeGenerator

Exceptions

ArgumentException

precision is not a precision, or the settings given so far allow no value.

Source(ZoneSource)

Read wall-clock times against source rather than the default zone source, and draw its zones unless Zones(Generator<TimeZoneInfo>) gives others.

public ZonedDateTimeGenerator Source(ZoneSource source)

Parameters

source ZoneSource

Returns

ZonedDateTimeGenerator

Exceptions

ArgumentException

Zones(Generator<TimeZoneInfo>) was given a generator from Zones(), which carries its own source; or source has no zone to draw.

Zones(Generator<TimeZoneInfo>)

The zones to draw: any generator of them, such as Generators.Temporal.Zones().Names(...) or Generators.Just(zone). A generator from Zones() brings its zone source with it. A zone from any other generator is looked up in this generator's zone source by its Id (or, for a Windows id the source has no zone under, by the IANA name .NET maps it to), and one the source does not have fails the draw with a HegelUsageException naming it.

public ZonedDateTimeGenerator Zones(Generator<TimeZoneInfo> zones)

Parameters

zones Generator<TimeZoneInfo>

Returns

ZonedDateTimeGenerator

Exceptions

ArgumentException

zones came from Zones() and Source(ZoneSource) was also called.