pub struct Utc;Expand description
Time scale representing Coordinated Universal Time (UTC). This scale is adjusted using leap seconds to closely match the rotation of the Earth. This makes it useful as civil time scale, but also means that external, discontinuous synchronization is required.
The synchronization based on leap seconds is implemented to occur at the date-time boundary. This means that it is only done when a UTC time point is created based on a date-time pair, after which it is converted into a time-since-epoch representation. This makes arithmetic over UTC time points much more efficient and entirely correct over all possible leap second boundaries.
This choice does also mean that introduction of new leap seconds does not “shift” any UTC time
stamps that were created to be after the point of introduction of this leap second. Generally,
this is desired behaviour, but in human communication it might not be. In such cases, users are
better off storing their UTC timestamps as date-time pairs and only converting them into
UtcTime at the point of use.
Trait Implementations§
Source§impl AbsoluteTimeScale for Utc
impl AbsoluteTimeScale for Utc
Source§const EPOCH: Date
const EPOCH: Date
This epoch is the exact date at which the modern definition of UTC started. This makes it useful, because users may choose to permit “proleptic” UTC dates before 1972 by using a signed representation, but may also choose to forbid it by using unsigned arithmetic, which leads to easy-to-detect underflows whenever an ambiguous pre-1972 UTC date-time is created.
Source§impl TerrestrialTime for Utc
impl TerrestrialTime for Utc
Source§const TAI_OFFSET: Duration = Duration::ZERO
const TAI_OFFSET: Duration = Duration::ZERO
Perhaps confusingly, we define UTC as coinciding with TAI. This is entirely possible because we handle leap seconds at the date-time boundary: after converting UTC into its time-since-epoch variation, there are no leap seconds to speak of anymore.