pub struct Timestamp(/* private fields */);Expand description
An instant for I18n::td and I18n::tdr, held
as a JS Date holds it: whole milliseconds since 1970-01-01 UTC, within ±8.64e15
(±100 000 000 days). Anything else is an invalid date: it formats as Invalid Date.
From i64 (milliseconds), f64 (milliseconds, truncated like new Date(ms); NaN
is invalid), off wasm32-unknown-unknown SystemTime; with feature time
OffsetDateTime, UtcDateTime and PrimitiveDateTime (as UTC). Sub-millisecond
parts are cut toward zero, as for SystemTime.
use i18n_next::Timestamp;
assert_eq!(Timestamp::from(1.9), Timestamp::from(1i64));
assert!(!Timestamp::from(f64::NAN).is_valid());
assert!(!Timestamp::from(8_640_000_000_000_001i64).is_valid());
assert_eq!(Timestamp::from(1_700_000_000_000i64).millis(), Some(1_700_000_000_000));Implementations§
Trait Implementations§
impl Copy for Timestamp
impl Eq for Timestamp
Source§impl From<SystemTime> for Timestamp
Available on not (target_os=unknown and WebAssembly).
impl From<SystemTime> for Timestamp
Available on not (
target_os=unknown and WebAssembly).Source§fn from(t: SystemTime) -> Self
fn from(t: SystemTime) -> Self
Converts to this type from the input type.
impl StructuralPartialEq for Timestamp
Auto Trait Implementations§
impl Forget for Timestamp
impl Freeze for Timestamp
impl Move for Timestamp
impl RefUnwindSafe for Timestamp
impl Send for Timestamp
impl Sync for Timestamp
impl Unpin for Timestamp
impl UnsafeUnpin for Timestamp
impl UnwindSafe for Timestamp
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