Hegel 0.18.3
Property-based testing for C++
Loading...
Searching...
No Matches
hegel::generators::temporal::ZoneOracle Struct Reference

A library that answers offset lookups but does not expose its zone data, probed into explicit transitions over the years first_year to last_year. More...

#include <zone_source.h>

Public Attributes

std::function< ZoneType(int64_t instant)> offset_at
std::function< std::optional< int64_t >(int64_t after)> next_transition
int32_t first_year = 1900
 The first year probed.
int32_t last_year = 2100
AfterProbe after = AfterProbe::Hold
 What is in force after last_year.

Detailed Description

A library that answers offset lookups but does not expose its zone data, probed into explicit transitions over the years first_year to last_year.

With next_transition the probe asks for each transition in turn; without it, it samples offset_at once a day and bisects each change to the second, which misses a pair of changes less than a day apart. Before first_year the type at its start holds; after last_year, after decides. Both callbacks are called on the thread that calls ZoneSource::add_oracle, during the call only. An exception a callback throws fails the call with std::invalid_argument carrying its message.

Member Data Documentation

◆ last_year

int32_t hegel::generators::temporal::ZoneOracle::last_year = 2100

The last year probed; at least first_year + 1 for AfterProbe::Infer.

◆ next_transition

std::function<std::optional<int64_t>(int64_t after)> hegel::generators::temporal::ZoneOracle::next_transition

Optional: the first instant after after at which the type in force changes, or std::nullopt when it never changes again.

◆ offset_at

std::function<ZoneType(int64_t instant)> hegel::generators::temporal::ZoneOracle::offset_at

Required: the type in force at an instant, in seconds since the Unix epoch.


The documentation for this struct was generated from the following file: