Module 0x2::clock
APIs for accessing time from move calls, via the Clock
: a unique
shared object that is created at 0x6 during genesis.
use 0x2::object;
use 0x2::transfer;
use 0x2::tx_context;
Resource Clock
Singleton shared object that exposes time to Move calls. This object is found at address 0x6, and can only be read (accessed via an immutable reference) by entry functions.
Entry Functions that attempt to accept Clock
by mutable
reference or value will fail to verify, and honest validators
will not sign or execute transactions that use Clock
as an
input parameter, unless it is passed by immutable reference.
struct Clock has key
Fields
Constants
Sender is not @0x0 the system address.
const ENotSystemAddress: u64 = 0;
Function timestamp_ms
The clock
's current timestamp as a running total of
milliseconds since an arbitrary point in the past.
public fun timestamp_ms(clock: &clock::Clock): u64
Implementation
Function create
Create and share the singleton Clock -- this function is called exactly once, during genesis.
fun create(ctx: &tx_context::TxContext)
Implementation
Function consensus_commit_prologue
fun consensus_commit_prologue(clock: &mut clock::Clock, timestamp_ms: u64, ctx: &tx_context::TxContext)