pub type BuildDate = i64;
Expand description
A build date in seconds since the epoch
This is a type alias for i64
.
§Examples
use std::num::IntErrorKind;
use std::str::FromStr;
use alpm_types::{BuildDate, Error, FromOffsetDateTime};
use time::OffsetDateTime;
// create BuildDate from OffsetDateTime
let datetime = BuildDate::from_offset_datetime(OffsetDateTime::from_unix_timestamp(1).unwrap());
assert_eq!(1, datetime);
// create BuildDate from &str
assert_eq!(BuildDate::from_str("1"), Ok(1));
assert!(BuildDate::from_str("foo").is_err());
Trait Implementations§
source§impl FromOffsetDateTime for BuildDate
impl FromOffsetDateTime for BuildDate
source§fn from_offset_datetime(input: OffsetDateTime) -> Self
fn from_offset_datetime(input: OffsetDateTime) -> Self
Converts a [OffsetDateTime
] into a BuildDate
.
Uses the unix timestamp of the [OffsetDateTime
].