Timestamp type exposing nanosecond precision with constructors and arithmetic.
// Source: https://github.com/unionlabs/union | License: Apache-2.0 | Copyright 2024 Union.fi Labs, Inc
// Provided via justclaw.it.com; keep this notice with the code.
//! Various types used in the public interfaces of consensus verification.
#![warn(clippy::pedantic, missing_docs, clippy::missing_const_for_fn)]
#![cfg_attr(not(feature = "std"), no_std)]
use core::{fmt, str::FromStr};
/// Represents a timestamp, normalized to nanoseconds.
///
/// In order to reduce confusion when dealing with many different consensus mechanisms that all
/// store timestamps differently, this type only exposes explicit constructors and accessors (for
/// both seconds and nanoseconds).
///
/// ```rust
/// # use consensus_primitives::Timestamp;
/// assert_eq!(Timestamp::from_nanos(1_000_000_000), Timestam
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key