pub struct NdbDateTime {
pub micros: i64,
}Expand description
Microseconds-precision UTC timestamp.
Stores microseconds since Unix epoch as i64. Supports dates from ~292,000 years BCE to ~292,000 years CE.
String format: ISO 8601 "2024-03-15T10:30:00.000000Z".
Fields§
§micros: i64Microseconds since Unix epoch (1970-01-01T00:00:00Z).
Implementations§
Source§impl NdbDateTime
impl NdbDateTime
Sourcepub fn from_micros(micros: i64) -> Self
pub fn from_micros(micros: i64) -> Self
Create from microseconds since epoch.
Sourcepub fn from_millis(millis: i64) -> Self
pub fn from_millis(millis: i64) -> Self
Create from milliseconds since epoch.
Sourcepub fn components(&self) -> DateTimeComponents
pub fn components(&self) -> DateTimeComponents
Extract year, month, day, hour, minute, second components.
Sourcepub fn to_iso8601(&self) -> String
pub fn to_iso8601(&self) -> String
Format as ISO 8601 string: "2024-03-15T10:30:00.000000Z".
Sourcepub fn parse(s: &str) -> Option<Self>
pub fn parse(s: &str) -> Option<Self>
Parse from ISO 8601 string (basic subset).
Supports: "2024-03-15T10:30:00Z", "2024-03-15T10:30:00.123456Z",
"2024-03-15" (midnight UTC).
Sourcepub fn add_duration(&self, d: NdbDuration) -> Self
pub fn add_duration(&self, d: NdbDuration) -> Self
Add a duration.
Sourcepub fn sub_duration(&self, d: NdbDuration) -> Self
pub fn sub_duration(&self, d: NdbDuration) -> Self
Subtract a duration.
Sourcepub fn duration_since(&self, other: &NdbDateTime) -> NdbDuration
pub fn duration_since(&self, other: &NdbDateTime) -> NdbDuration
Duration between two timestamps.
Sourcepub fn unix_millis(&self) -> i64
pub fn unix_millis(&self) -> i64
Unix epoch milliseconds.
Trait Implementations§
Source§impl Clone for NdbDateTime
impl Clone for NdbDateTime
Source§fn clone(&self) -> NdbDateTime
fn clone(&self) -> NdbDateTime
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for NdbDateTime
impl Debug for NdbDateTime
Source§impl<'de> Deserialize<'de> for NdbDateTime
impl<'de> Deserialize<'de> for NdbDateTime
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Display for NdbDateTime
impl Display for NdbDateTime
Source§impl From<NdbDateTime> for Value
impl From<NdbDateTime> for Value
Source§fn from(dt: NdbDateTime) -> Self
fn from(dt: NdbDateTime) -> Self
Converts to this type from the input type.
Source§impl Hash for NdbDateTime
impl Hash for NdbDateTime
Source§impl Ord for NdbDateTime
impl Ord for NdbDateTime
Source§fn cmp(&self, other: &NdbDateTime) -> Ordering
fn cmp(&self, other: &NdbDateTime) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for NdbDateTime
impl PartialEq for NdbDateTime
Source§impl PartialOrd for NdbDateTime
impl PartialOrd for NdbDateTime
Source§impl Serialize for NdbDateTime
impl Serialize for NdbDateTime
impl Copy for NdbDateTime
impl Eq for NdbDateTime
impl StructuralPartialEq for NdbDateTime
Auto Trait Implementations§
impl Freeze for NdbDateTime
impl RefUnwindSafe for NdbDateTime
impl Send for NdbDateTime
impl Sync for NdbDateTime
impl Unpin for NdbDateTime
impl UnsafeUnpin for NdbDateTime
impl UnwindSafe for NdbDateTime
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
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§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Returns the layout of the type.
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Returns whether the given value has been niched. Read more
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
Writes data to
out indicating that a T is niched.