Time

Time represents a specific moment within a universe's timeline.

Representation

Time is conceptually similar to a tuple of (block_num, txn_index, log_index), providing a structured way to track when events occur.

struct Time {
    uint64 block;
    uint32 second;
    uint32 third;
}

Fields

TypeFieldDescription
uint64blockThe number of the block on the universe chain where the event occurred.
uint32secondThe index of the transaction within that block where the event was logged.
uint32thirdThe index of the log entry within the transaction that records the event.

Encoding

The Time structure can be encoded into a u128:

(uint128(block) << 64) | (uint128(second) << 32) | uint128(third)

Written Format

Time is commonly written in the format of block:second:third.

For example:

  • 0:0:0 - The beginning of a universe.
  • 123456:0:0 - An event occurring at block 123456, transaction 0, log entry 0.
  • 122456:7:8 - An event occurring at block 122456, transaction 7, log entry 8.