Function gstd::exec::block_timestamp

pub fn block_timestamp() -> u64
Expand description

Get the current block timestamp.

The timestamp is the number of milliseconds elapsed since the Unix epoch.

§Examples

Send a reply after the block timestamp reaches February 22, 2022:

use gcore::{exec, msg};

#[no_mangle]
extern "C" fn handle() {
    if exec::block_timestamp() >= 1645488000000 {
        msg::reply(b"The current block is generated after February 22, 2022", 0)
            .expect("Unable to reply");
    }
}