Library globals

Class globals . mp_broadcast . LamportClock

View source

Lamport clock. Useful for creating a total order for events or messages.
The users' callsigns are used to break ties.

LamportClock.new()
Creates a new lamport clock for this user.

LamportClock.merge(sender, sender_timestamp)
Merges the timestamp from the sender with the local clock.
sender           : base node of the senders property tree
sender_timestamp : the timestamp received from the sender.
Returns 1 if the local clock was advanced; 0 otherwise.

LamportClock.advance()
Advances the local clock one tick.

LamportClock.timestamp()
Returns an encoded 4 character long timestamp from the local clock.

Functions

advance

merge

new

LamportClock.new() Creates a new lamport clock for this user.

timestamp