pub struct UnixMillis(/* private fields */);Expand description
A time on a host’s wall clock, in whole milliseconds since the Unix epoch: when a run started or ended, when a held call is asked again, when a daemon started. A host reads it for its own records, and a run never sees it as a value.
Its range is the epoch through u64::MAX milliseconds after it, and
every conversion into it keeps the one rule UnixMillis::since_epoch
states. Only reading text refuses a time outside the range
(Outside), since a person gave it. A clock is read where a host
reads one: this type only does the arithmetic on what it read.
Its text is the Instant it names, as an Instant is written. Its
integer form, which a lock file, the daemon’s pipe and a log line carry,
is UnixMillis::as_millis, and it is what its Debug form shows.
Implementations§
Source§impl UnixMillis
impl UnixMillis
Sourcepub const EPOCH: UnixMillis
pub const EPOCH: UnixMillis
The Unix epoch.
Sourcepub const fn from_millis(millis: u64) -> UnixMillis
pub const fn from_millis(millis: u64) -> UnixMillis
The time millis milliseconds after the epoch: its integer form.
Sourcepub fn since_epoch(offset: Result<Duration, Duration>) -> UnixMillis
pub fn since_epoch(offset: Result<Duration, Duration>) -> UnixMillis
The time offset from the epoch, Ok after it and Err before it,
as SystemTime::duration_since(UNIX_EPOCH) gives a clock reading.
The one rule: a time before the epoch is the epoch, a time past
u64::MAX milliseconds is that last millisecond, and a fraction of
a millisecond is dropped.
Sourcepub const fn offset(self) -> Duration
pub const fn offset(self) -> Duration
Its offset from the epoch: what UnixMillis::since_epoch reads
back as this time.
Sourcepub fn instant(self) -> Instant
pub fn instant(self) -> Instant
The Instant this time names.
§Panics
Never: normalizing a count of milliseconds scaled by 10^-3 only
raises its exponent towards zero.
Sourcepub fn from_instant(at: &Instant) -> UnixMillis
pub fn from_instant(at: &Instant) -> UnixMillis
The time at is, by UnixMillis::since_epoch’s rule.
Sourcepub fn at_or_after(at: &Instant) -> UnixMillis
pub fn at_or_after(at: &Instant) -> UnixMillis
The first time at or after at: UnixMillis::from_instant’s,
one millisecond on when that drops a fraction. What a host asks a
held call again at, so it is never asked before its retry_at.
Trait Implementations§
Source§impl Clone for UnixMillis
impl Clone for UnixMillis
impl Copy for UnixMillis
Source§impl Debug for UnixMillis
impl Debug for UnixMillis
Source§impl Display for UnixMillis
The Instant it names, such as 2026-11-19T10:02:11.482Z, with the
fewest fractional-second digits that are exact.
impl Display for UnixMillis
The Instant it names, such as 2026-11-19T10:02:11.482Z, with the
fewest fractional-second digits that are exact.
impl Eq for UnixMillis
Source§impl FromStr for UnixMillis
An Instant’s text, read as decoding reads one (crate::primitives::instant),
a fraction finer than a millisecond dropped.
impl FromStr for UnixMillis
An Instant’s text, read as decoding reads one (crate::primitives::instant),
a fraction finer than a millisecond dropped.
Source§type Err = TimeTextError
type Err = TimeTextError
Source§fn from_str(text: &str) -> Result<UnixMillis, TimeTextError>
fn from_str(text: &str) -> Result<UnixMillis, TimeTextError>
s to return a value of this type. Read moreSource§impl Hash for UnixMillis
impl Hash for UnixMillis
Source§impl Ord for UnixMillis
impl Ord for UnixMillis
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for UnixMillis
impl PartialEq for UnixMillis
Source§impl PartialOrd for UnixMillis
impl PartialOrd for UnixMillis
Source§impl Shaped for UnixMillis
A time is written as the value encoding writes an Instant, which is
how a note keeps one (trace.md, Host notes): an Instant that is not
a whole number of milliseconds in the range is no such time.
impl Shaped for UnixMillis
A time is written as the value encoding writes an Instant, which is
how a note keeps one (trace.md, Host notes): an Instant that is not
a whole number of milliseconds in the range is no such time.
Source§fn write_at(
&self,
out: &mut ValueWriter<'_, '_>,
ty: &Type,
) -> Result<(), EncodeError>
fn write_at( &self, out: &mut ValueWriter<'_, '_>, ty: &Type, ) -> Result<(), EncodeError>
Source§fn read_at(
input: &mut ValueReader<'_, '_, '_>,
ty: &Type,
) -> Result<Self, DecodeError>
fn read_at( input: &mut ValueReader<'_, '_, '_>, ty: &Type, ) -> Result<Self, DecodeError>
impl StructuralPartialEq for UnixMillis
Source§impl Wire for UnixMillis
impl Wire for UnixMillis
Source§fn write_head<'a>(&'a self, out: &mut Vec<u8>, _: &mut Vec<&'a dyn AnyWire>)
fn write_head<'a>(&'a self, out: &mut Vec<u8>, _: &mut Vec<&'a dyn AnyWire>)
out, and pushes
its parts to parts in the order they are written after them.Source§fn open(reader: &mut Reader<'_>) -> Result<Opened, DecodeError>
fn open(reader: &mut Reader<'_>) -> Result<Opened, DecodeError>
reader: the value itself when it has no parts,
else its parts to read and what joins them. Read moreSource§fn write(&self, out: &mut Vec<u8>)
fn write(&self, out: &mut Vec<u8>)
out: its head, and then each part’s bytes in
order, written over a stack on the heap, so a value nested however
deep is written on a native stack of fixed size.Auto Trait Implementations§
impl Forget for UnixMillis
impl Freeze for UnixMillis
impl Move for UnixMillis
impl RefUnwindSafe for UnixMillis
impl Send for UnixMillis
impl Sync for UnixMillis
impl Unpin for UnixMillis
impl UnsafeUnpin for UnixMillis
impl UnwindSafe for UnixMillis
Blanket Implementations§
Source§impl<T> AnyWire for Twhere
T: Wire,
impl<T> AnyWire for Twhere
T: Wire,
Source§fn write_head<'a>(&'a self, out: &mut Vec<u8>, parts: &mut Vec<&'a dyn AnyWire>)
fn write_head<'a>(&'a self, out: &mut Vec<u8>, parts: &mut Vec<&'a dyn AnyWire>)
Wire::write_head.