Struct Timestamp
pub struct Timestamp { /* private fields */ }
The representation for a timestamp used by the TZif implementation.
We don't use Timestamp from the root of this crate
because TZif data doesn't require nanosecond resolution. Instead, this
representation uses only second resolution. This makes for a more compact
sequence of transitions, which means more data fits into cache and thus
faster binary search.
Implementations
impl Timestamp
const MIN: Timestamp = _;The minimum timestamp value.
const MAX: Timestamp = _;The maximum timestamp value.
const UNIX_EPOCH: Timestamp = _;The zero value for a timestamp, which also corresponds to the Unix epoch (
1970-01-01T00:00:00Z).const fn new(ts: Timestamp) -> TimestampCreates a new TZif timestamp from jiff-core's standard timestamp type.
Any fractional second is rounded down to the preceding whole second. This ensures that a timestamp just before a transition stays before it, even when the timestamp is negative.
const fn from_second(second: i64) -> Result<Timestamp, RangeError>Creates a new
Timestampfrom a Unix timestamp integer value.This returns an error if the value is not in the legal bounds for this type.
const fn as_second(self) -> i64Returns the second value of this timestamp.
It is the number of seconds since the Unix epoch (
1970-01-01T00:00:00Z). Timestamps prior to the Unix epoch are negative. Timestamps are the Unix epoch are0.const fn to_datetime(self, offset: Offset) -> DateTimeConverts this timestamp to a civil datetime for the offset given.
const fn to_standard_timestamp(self) -> TimestampConverts this timestamp back to the "standard" timestamp.
Note that the timestamp returned here always has its nanosecond component set to
0.
Trait Implementations
impl Clone for Timestamp
fn clone(&self) -> Self
impl Copy for Timestamp
impl Debug for Timestamp
fn fmt(&self, f: &mut Formatter<'_>) -> Result
impl Eq for Timestamp
impl Hash for Timestamp
fn hash<__H: Hasher>(&self, state: &mut __H)
impl Ord for Timestamp
fn cmp(&self, other: &Self) -> Ordering
impl PartialEq for Timestamp
fn eq(&self, other: &Self) -> bool
impl PartialOrd for Timestamp
fn partial_cmp(&self, other: &Self) -> Option<Ordering>