Type Alias ssi_claims::chrono::offset::MappedLocalTime
source · pub type MappedLocalTime<T> = LocalResult<T>;
Expand description
The result of mapping a local time to a concrete instant in a given time zone.
The calculation to go from a local time (wall clock time) to an instant in UTC can end up in three cases:
- A single, simple result.
- An ambiguous result when the clock is turned backwards during a transition due to for example DST.
- No result when the clock is turned forwards during a transition due to for example DST.
When the clock is turned backwards it creates a fold in local time, during which the local time is ambiguous. When the clock is turned forwards it creates a gap in local time, during which the local time is missing, or does not exist.
Chrono does not return a default choice or invalid data during time zone transitions, but has
the MappedLocalTime
type to help deal with the result correctly.
The type of T
is usually a DateTime
but may also be only an offset.
Aliased Type§
enum MappedLocalTime<T> {
Single(T),
Ambiguous(T, T),
None,
}
Variants§
Single(T)
The local time maps to a single unique result.
Ambiguous(T, T)
The local time is ambiguous because there is a fold in the local time.
This variant contains the two possible results, in the order (earliest, latest)
.
None
The local time does not exist because there is a gap in the local time.
This variant may also be returned if there was an error while resolving the local time, caused by for example missing time zone data files, an error in an OS API, or overflow.