pub struct DeltaSeconds(/* private fields */);Expand description
The range of seconds for the possible differences between any two pairs
of (timestamp, offset).
All of our span types (except for years and months, since they have variable length even in civil datetimes) are defined in terms of this constant. The way it’s defined is a little odd, so let’s break it down.
Firstly, a span of seconds should be able to represent at least the
complete span supported by Timestamp. Thus, it’s based off of
UnixSeconds::LEN. That is, a span should be able to represent the
value UnixSeconds::MAX - UnixSeconds::MIN.
Secondly, a span should also be able to account for any amount of
possible time that a time zone offset might add or subtract to an
Timestamp. This also means it can account for any difference between
two civil::DateTime values.
Thirdly, we would like our span to be divisible by
SECONDS_PER_CIVIL_DAY. This isn’t strictly required, but it makes
defining boundaries a little smoother. If it weren’t divisible, then the
lower bounds on some types would need to be adjusted by one.
Note that neither the existence of this constant nor defining our spans based on it impacts the correctness of doing arithmetic on zoned instants. Arithmetic on zoned instants still uses “civil” spans, but the length of time for some units (like a day) might vary. The arithmetic for zoned instants accounts for this explicitly. But it still must obey the limits set here.