pub fn block_timestamp() -> Result<u64>Expand description
Returns the current block timestamp (Unix seconds).
This is the timestamp of the current batch being executed. Useful for time-based logic, but note that it updates in ~200ms intervals.
§Returns
Unix timestamp in seconds as a u64.
§Example
ⓘ
let now = context::block_timestamp()?;
let deadline = storage.read_deadline()?;
if now > deadline {
return Err(Error::new(ERR_DEADLINE_PASSED));
}