Struct cosmwasm_std::BlockInfo [−][src]
Fields
height: u64
time: Timestamp
Absolute time of the block creation in seconds since the UNIX epoch (00:00:00 on 1970-01-01 UTC).
The source of this is the BFT Time in Tendermint,
which has the same nanosecond precision as the Timestamp
type.
Examples
Using chrono:
use chrono::NaiveDateTime; let seconds = env.block.time.seconds(); let nsecs = env.block.time.subsec_nanos(); let dt = NaiveDateTime::from_timestamp(seconds as i64, nsecs as u32);
Creating a simple millisecond-precision timestamp (as used in JavaScript):
let millis = env.block.time.nanos() / 1_000_000;
chain_id: String
Trait Implementations
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations
impl RefUnwindSafe for BlockInfo
impl UnwindSafe for BlockInfo
Blanket Implementations
Mutably borrows from an owned value. Read more
type Output = T
type Output = T
Should always be Self