pub struct Epoch { /* private fields */ }
Expand description
A struct that provides conversions to/from epochs/date/time.
Implementations§
source§impl Epoch
impl Epoch
sourcepub const fn new(datetime: OffsetDateTime) -> Epoch
pub const fn new(datetime: OffsetDateTime) -> Epoch
Instantiates a new Epoch
sourcepub fn from_parts(parts: DateTimeParts) -> Result<Epoch>
pub fn from_parts(parts: DateTimeParts) -> Result<Epoch>
Creates a new Epoch from DateTimeParts
sourcepub fn from_epoch_s(epoch_s: i64) -> Result<Epoch>
pub fn from_epoch_s(epoch_s: i64) -> Result<Epoch>
Creates an epoch from seconds
sourcepub fn from_epoch_ms(epoch_ms: i128) -> Result<Epoch>
pub fn from_epoch_ms(epoch_ms: i128) -> Result<Epoch>
Creates an epoch from milliseconds
sourcepub fn from_epoch_us(epoch_us: i128) -> Result<Epoch>
pub fn from_epoch_us(epoch_us: i128) -> Result<Epoch>
Creates an epoch from microseconds
sourcepub fn from_epoch_ns(epoch_ns: i128) -> Result<Epoch>
pub fn from_epoch_ns(epoch_ns: i128) -> Result<Epoch>
Creates an epoch from nanoseconds
Trait Implementations§
source§impl TryFrom<DateTimeParts> for Epoch
impl TryFrom<DateTimeParts> for Epoch
source§fn try_from(parts: DateTimeParts) -> Result<Self>
fn try_from(parts: DateTimeParts) -> Result<Self>
Attempts to convert DateTimeParts into an Epoch
§type Error = EpochError
type Error = EpochError
The type returned in the event of a conversion error.