pub(crate) type SpanZoneOffsetHours = ri8<-25, 25>;
Expand description
The number of hours allowed in a time zone offset.
This number was somewhat arbitrarily chosen. In part because it’s
bigger than any current offset by a wide margin, and in part because
POSIX TZ
strings require the ability to store offsets in the range
-24:59:59..=25:59:59
. Note though that we make the range a little bigger
with -25:59:59..=25:59:59
so that negating an offset always produces a
valid offset.
Note that RFC 8536 actually allows offsets to be much bigger, namely, in
the range (-2^31, 2^31)
, where both ends are exclusive (-2^31
is
explicitly disallowed, and 2^31
overflows a signed 32-bit integer). But
RFC 8536 does say that it should be in the range [-89999, 93599]
, which
matches POSIX. In order to keep our offset small, we stick roughly to what
POSIX requires.
Aliased Type§
pub(crate) struct SpanZoneOffsetHours {
pub(crate) val: i8,
pub(crate) min: i8,
pub(crate) max: i8,
}
Fields§
§val: i8
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: i8
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: i8
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.)