Struct UnixEpochSeconds
pub struct UnixEpochSeconds(/* private field */);
The supported range of seconds for the difference between any two
values of UnixEpochDays.
This range should correspond to the first second of Year::MIN
(with a minimal offset) up through (and including) the last second
of Year::MAX (with a maximal offset). Actually computing that is
non-trivial, however, it can be computed easily enough using Unix
programs like date:
$ TZ=0 date -d 'Mon Jan 1 12:00:00 AM -9999' +'%s'
date: invalid date ‘Mon Jan 1 12:00:00 AM -9999’
$ TZ=0 date -d 'Fri Dec 31 23:59:59 9999' +'%s'
253402300799
Well, almost easily enough. date apparently doesn't support negative
years. But it does support negative timestamps:
$ TZ=0 date -d '@-377705116800'
Mon Jan 1 12:00:00 AM -9999
$ TZ=0 date -d '@253402300799'
Fri Dec 31 11:59:59 PM 9999
With that said, we actually end up restricting the range a bit more
than what's above. Namely, what's above is what we support for civil
datetimes. Because of time zones, we need to choose whether all
Timestamp values can be infallibly converted to civil::DateTime
values, or whether all civil::DateTime values can be infallibly
converted to Timestamp values. Jiff choses the former because getting
a civil datetime is important for formatting. If Jiff didn't choose the
former, there would be some timestamps that could not be formatted.
Thus, we make room by shrinking the range of allowed instants by
precisely the maximum supported time zone offset.
Implementations
impl UnixEpochSeconds
const MIN: i64 = <UnixEpochSeconds as Bounds>::MIN;const MAX: i64 = <UnixEpochSeconds as Bounds>::MAX;const LEN: i128 = _;const fn error() -> BoundsErrorfn check(n: impl Into<i64>) -> Result<i64, BoundsError>const fn checkc(n: i64) -> Result<i64, BoundsError>const fn checked_add(n1: i64, n2: i64) -> Result<i64, BoundsError>fn checked_mul(n1: i64, n2: i64) -> Result<i64, BoundsError>
Trait Implementations
impl Bounds for UnixEpochSeconds
const WHAT: &'static str = "Unix timestamp seconds";const MIN: Self::Primitive = _;const MAX: Self::Primitive = _;type Primitive = i64;type Error = BoundsError;fn error() -> BoundsError
impl Eq for UnixEpochSeconds
impl PartialEq for UnixEpochSeconds
fn eq(&self, other: &Self) -> bool