Struct fog_pack::types::Timestamp[][src]

pub struct Timestamp { /* fields omitted */ }

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:

  1. If nanoseconds is nonzero, encode the standard byte, the seconds as little-endian i64, and the nanoseconds as little-endian u32.
  2. If nanoseconds is zero & seconds maps to a u32, encode the standard byte, and the seconds as little-endian u32.
  3. 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.

impl Clone for Timestamp[src]

impl Copy for Timestamp[src]

impl Debug for Timestamp[src]

impl<'de> Deserialize<'de> for Timestamp[src]

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]

impl Ord for Timestamp[src]

impl PartialEq<Timestamp> for Timestamp[src]

impl PartialOrd<Timestamp> for Timestamp[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.

impl TryFrom<&'_ [u8]> for Timestamp[src]

type Error = String

The type returned in the event of a conversion error.

impl TryFrom<Value> for Timestamp[src]

type Error = Value

The type returned in the event of a conversion error.

impl<'a> TryFrom<ValueRef<'a>> for Timestamp[src]

type Error = ValueRef<'a>

The type returned in the event of a conversion error.

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,