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

A calendar span: a signed count of each unit from years to nanoseconds, never normalised (90 minutes is not an hour and a half, and a month is not a number of days). More...

#include <temporal_types.h>

Public Member Functions

int64_t get (SpanUnit unit) const

Public Attributes

int64_t years = 0
 Calendar years.
int64_t months = 0
 Calendar months.
int64_t weeks = 0
 Weeks.
int64_t days = 0
 Days.
int64_t hours = 0
 Hours.
int64_t minutes = 0
 Minutes.
int64_t seconds = 0
 Seconds.
int64_t milliseconds = 0
 Milliseconds.
int64_t microseconds = 0
 Microseconds.
int64_t nanoseconds = 0
 Nanoseconds.

Detailed Description

A calendar span: a signed count of each unit from years to nanoseconds, never normalised (90 minutes is not an hour and a half, and a month is not a number of days).

Every unit shares one sign unless the span was drawn with SpanSign::Mixed. Prints each nonzero unit in the friendly form 1y 2mo 3w 4d 5h 6m 7s 8ms 9µs 10ns, and 0s for zero. A span with no positive unit has one leading - for all its units (-3d 4h is -3 days and -4 hours), and a span with units of both signs has a sign on each unit (-3d +4h).

Member Function Documentation

◆ get()

int64_t hegel::generators::temporal::Span::get ( SpanUnit unit) const

The count of one unit in this span.

Parameters
unitThe unit to read.
Returns
The count of unit.

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