pub struct Instant { /* private fields */ }
Expand description
An instant is an exact point on the timeline, irrespective of time zone or calendar format, with millisecond precision.
Internally, this is represented by a 64-bit integer of seconds, and a 16-bit integer of milliseconds. This means that it will overflow (and thus be unsuitable for) instants past GMT 15:30:08, Sunday 4th December, 292,277,026,596 (yes, that’s a year)
Implementations§
Source§impl Instant
impl Instant
Sourcepub fn at(seconds: i64) -> Self
pub fn at(seconds: i64) -> Self
Creates a new Instant set to the number of seconds since the Unix epoch, and zero milliseconds.
Sourcepub fn at_ms(seconds: i64, milliseconds: i16) -> Self
pub fn at_ms(seconds: i64, milliseconds: i16) -> Self
Creates a new Instant set to the number of seconds since the Unix epoch, along with the number of milliseconds so far this second.
Sourcepub fn milliseconds(&self) -> i16
pub fn milliseconds(&self) -> i16
Returns the number of milliseconds at this instant
Trait Implementations§
Source§impl Ord for Instant
impl Ord for Instant
Source§impl PartialOrd for Instant
impl PartialOrd for Instant
impl Copy for Instant
impl Eq for Instant
impl StructuralPartialEq for Instant
Auto Trait Implementations§
impl Freeze for Instant
impl RefUnwindSafe for Instant
impl Send for Instant
impl Sync for Instant
impl Unpin for Instant
impl UnwindSafe for Instant
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)