HLClock v0.1.2 HLClock.Timestamp View Source

HLC Timestamp

Implements the necessary components of the HLC tuple (i.e. logical time and logical counter) with extension to support node ids to provide unique timestamps even in cases where time and counter are the same

Binary representations assume big endianness for interop simplicity with other languages/representations.

Link to this section Summary

Functions

Determines if the clock’s timestamp “happened before” a different timestamp

Exhaustive comparison of two timestamps: precedence is in order of time component, logical counter, and finally node identifier

Construct a Timestamp from the binary representation

Pack the rich Timestamp struct as a 128 bit byte array

Construct a timestamp from its principal components: logical time (initially node’s physical time), logical counter (initally zero), and the node id

Given the current timestamp for this node and a provided remote timestamp, perform the merge of both logical time and logical counters. Returns the new current timestamp for the local node

Generate a single HLC Timestamp for sending to other nodes or local causality tracking

Link to this section Functions

Determines if the clock’s timestamp “happened before” a different timestamp

Exhaustive comparison of two timestamps: precedence is in order of time component, logical counter, and finally node identifier

Construct a Timestamp from the binary representation

Pack the rich Timestamp struct as a 128 bit byte array

48 bits - Physical time 16 bits - Logical time 64 bits - Node ID

Link to this function new(time, counter, node_id \\ 0) View Source

Construct a timestamp from its principal components: logical time (initially node’s physical time), logical counter (initally zero), and the node id

Link to this function recv(local, remote, physical_time) View Source

Given the current timestamp for this node and a provided remote timestamp, perform the merge of both logical time and logical counters. Returns the new current timestamp for the local node

Generate a single HLC Timestamp for sending to other nodes or local causality tracking