Struct fog_pack::types::Timestamp [−][src]
Structure for holding a raw fog-pack timestamp. This stores time in some consistent internal format, which may or may not be UTC. UTC time can always be extracted from it.
Implementations
impl Timestamp[src]
pub fn from_utc(sec: i64, nano: u32) -> Option<Timestamp>[src]
Create a timestamp from a raw seconds + nanoseconds value
pub fn from_sec(sec: i64) -> Timestamp[src]
pub const fn zero() -> Timestamp[src]
Zero time - UTC epoch time
pub const fn min_value() -> Timestamp[src]
Minimum possible time that can be represented
pub const fn max_value() -> Timestamp[src]
Maximum possible time that can be represented
pub fn min(self, other: Timestamp) -> Timestamp[src]
pub fn max(self, other: Timestamp) -> Timestamp[src]
pub fn next(self) -> Timestamp[src]
Add 1 nanosecond to timestamp. Will go into leap second (nanoseconds > 1e6) before it goes to the next second.
pub fn prev(self) -> Timestamp[src]
Subtract 1 nanosecond from timestamp. Will go into leap second (nanoseconds > 1e6) when it must decrement a second.
pub fn timestamp_utc(&self) -> i64[src]
Return the UNIX timestamp (number of seconds since January 1, 1970 0:00:00 UTC). As a reminder, this is UTC time and thus includes leap seconds.
pub fn timestamp_subsec_nanos(&self) -> u32[src]
Returns the number of nanoseconds past the second count.
pub fn as_vec(&self) -> Vec<u8>[src]
Convert into a byte vector. For extending an existing byte vector, see
encode_vec.
pub fn encode_vec(&self, vec: &mut Vec<u8>)[src]
Encode onto a byte vector one of 3 formats:
- If nanoseconds is nonzero, encode the standard byte, the seconds as little-endian i64, and the nanoseconds as little-endian u32.
- If nanoseconds is zero & seconds maps to a u32, encode the standard byte, and the seconds as little-endian u32.
- If nanoseconds is zero & seconds does not map to a u32, encode the standard byte, and the seconds as little-endian i64.
pub fn size(&self) -> usize[src]
pub fn now() -> Option<Timestamp>[src]
Create a Timestamp based on the current system time. Can fail if the system clock is extremely wrong - the time is before Unix Epoch, or nanosecond portion is greater than 2 seconds.
Trait Implementations
impl Add<i64> for Timestamp[src]
type Output = Timestamp
The resulting type after applying the + operator.
fn add(self, rhs: i64) -> Self[src]
impl Clone for Timestamp[src]
impl Copy for Timestamp[src]
impl Debug for Timestamp[src]
impl<'de> Deserialize<'de> for Timestamp[src]
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where
D: Deserializer<'de>, [src]
D: Deserializer<'de>,
impl Display for Timestamp[src]
impl Eq for Timestamp[src]
impl From<Timestamp> for Value[src]
impl<'a> From<Timestamp> for ValueRef<'a>[src]
impl Hash for Timestamp[src]
fn hash<__H: Hasher>(&self, state: &mut __H)[src]
pub fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher, 1.3.0[src]
H: Hasher,
impl Ord for Timestamp[src]
fn cmp(&self, other: &Timestamp) -> Ordering[src]
#[must_use]pub fn max(self, other: Self) -> Self1.21.0[src]
#[must_use]pub fn min(self, other: Self) -> Self1.21.0[src]
#[must_use]pub fn clamp(self, min: Self, max: Self) -> Self1.50.0[src]
impl PartialEq<Timestamp> for Timestamp[src]
impl PartialOrd<Timestamp> for Timestamp[src]
fn partial_cmp(&self, other: &Timestamp) -> Option<Ordering>[src]
#[must_use]pub fn lt(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]pub fn le(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]pub fn gt(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]pub fn ge(&self, other: &Rhs) -> bool1.0.0[src]
impl Serialize for Timestamp[src]
impl StructuralEq for Timestamp[src]
impl StructuralPartialEq for Timestamp[src]
impl Sub<i64> for Timestamp[src]
type Output = Timestamp
The resulting type after applying the - operator.
fn sub(self, rhs: i64) -> Self[src]
impl TryFrom<&'_ [u8]> for Timestamp[src]
type Error = String
The type returned in the event of a conversion error.
fn try_from(value: &[u8]) -> Result<Self, Self::Error>[src]
impl TryFrom<Value> for Timestamp[src]
type Error = Value
The type returned in the event of a conversion error.
fn try_from(v: Value) -> Result<Self, Self::Error>[src]
impl<'a> TryFrom<ValueRef<'a>> for Timestamp[src]
Auto Trait Implementations
impl RefUnwindSafe for Timestamp
impl Send for Timestamp
impl Sync for Timestamp
impl Unpin for Timestamp
impl UnwindSafe for Timestamp
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T[src]
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>, [src]
T: for<'de> Deserialize<'de>,
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone, [src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T[src]
pub fn clone_into(&self, target: &mut T)[src]
impl<T> ToString for T where
T: Display + ?Sized, [src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,