pub struct Timestamp(/* private fields */);
Expand description
A Timestamp for RRSIG Records.
DNS uses 32 bit timestamps that are conceptionally
viewed as the 32 bit modulus of a larger number space. Because of that,
special rules apply when processing these values.
RFC 4034 defines Timestamps as the number of seconds elepased since
since 1 January 1970 00:00:00 UTC, ignoring leap seconds. Timestamps
are compared using so-called “Serial number arithmetic”, as defined in
RFC 1982.
The RFC defines the semantics for doing arithmetics in the
face of these wrap-arounds. This type implements these semantics atop a
native u32
. The RFC defines two operations: addition and comparison.
For addition, the amount added can only be a positive number of up to
2^31 - 1
. Because of this, we decided to not implement the
Add
trait but rather have a dedicated method add
so as to not cause
surprise panics.
Timestamps only implement a partial ordering. That is, there are
pairs of values that are not equal but there still isn’t one value larger
than the other. Since this is neatly implemented by the PartialOrd
trait, the type implements that.
Implementations§
source§impl Timestamp
impl Timestamp
source§impl Timestamp
impl Timestamp
§Parsing and Composing
pub const COMPOSE_LEN: u16 = 4u16
pub fn parse<Octs: AsRef<[u8]> + ?Sized>( parser: &mut Parser<'_, Octs>, ) -> Result<Self, ParseError>
pub fn compose<Target: Composer + ?Sized>( &self, target: &mut Target, ) -> Result<(), Target::AppendError>
Trait Implementations§
source§impl CanonicalOrd for Timestamp
impl CanonicalOrd for Timestamp
source§fn canonical_cmp(&self, other: &Self) -> Ordering
fn canonical_cmp(&self, other: &Self) -> Ordering
self
and other
.source§fn canonical_lt(&self, other: &Rhs) -> bool
fn canonical_lt(&self, other: &Rhs) -> bool
self
is canonically less than other
.source§fn canonical_le(&self, other: &Rhs) -> bool
fn canonical_le(&self, other: &Rhs) -> bool
self
is canonically less than or equal to other
.source§fn canonical_gt(&self, other: &Rhs) -> bool
fn canonical_gt(&self, other: &Rhs) -> bool
self
is canonically greater than other
.source§fn canonical_ge(&self, other: &Rhs) -> bool
fn canonical_ge(&self, other: &Rhs) -> bool
self
is canonically greater than or equal to other
.source§impl PartialOrd for Timestamp
impl PartialOrd for Timestamp
impl Copy for Timestamp
impl StructuralPartialEq for Timestamp
Auto Trait Implementations§
impl Freeze for Timestamp
impl RefUnwindSafe for Timestamp
impl Send for Timestamp
impl Sync for Timestamp
impl Unpin for Timestamp
impl UnwindSafe for Timestamp
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)