pub(crate) type UnixEpochDay = ri32<{ _ }, { _ }>;
Expand description
The number of days from the Unix epoch for the Gregorian calendar.
The range supported is based on the range of Unix timestamps that we support.
While I had originally used the “rate die” concept from Calendrical Calculations, I found Howard Hinnant’s formulation much more straight-forward. And while I didn’t benchmark them, it also appears faster.
Aliased Type§
pub(crate) struct UnixEpochDay {
pub(crate) val: i32,
pub(crate) min: i32,
pub(crate) max: i32,
}
Fields§
§val: i32
The actual value of the integer.
Callers should not access this directly. There are some very rare cases where algorithms are too difficult to express on ranged integers, and it’s useful to be able to reach inside and access the raw value directly. (For example, the conversions between Unix epoch day and Gregorian date.)
min: i32
The minimum possible value computed so far.
This value is only present when debug_assertions
are enabled.
In that case, it is used to ensure the minimum possible value
when the integer is actually observed (or converted) is still
within the legal range.
Callers should not access this directly. There are some very rare cases where algorithms are too difficult to express on ranged integers, and it’s useful to be able to reach inside and access the raw value directly. (For example, the conversions between Unix epoch day and Gregorian date.)
max: i32
The maximum possible value computed so far.
This value is only present when debug_assertions
are enabled.
In that case, it is used to ensure the maximum possible value
when the integer is actually observed (or converted) is still
within the legal range.
Callers should not access this directly. There are some very rare cases where algorithms are too difficult to express on ranged integers, and it’s useful to be able to reach inside and access the raw value directly. (For example, the conversions between Unix epoch day and Gregorian date.)