Lamport vs Vector Clock

4 processes (P1, P2, P3, P4) with events a,b,c,d,e,f,g,…

Multiprocess-Events

Lamport Clock Timestamps
https://en.wikipedia.org/wiki/Lamport_timestamps

For each process, p:
    initialize the timestamp, TS = 0;
    on each event, e:
        if e is receiving message m, 
            p.TS = max(m.TS, p.TS);
        p.TS++; 
        e.TS = p.TS;
        if e is sending message m, 
            m.TS = p.TS;

Lamport-Clock-Timestamp

Vector Clock Timestamps
https://en.wikipedia.org/wiki/Vector_clock

For M processes:
    initialize the timestamp, p.VT = (0,0,..,0);
    on each event, e:
        if e is receiving message m, 
            for i=1 to M, 
                p.VT[i] = max(m.VT[I], p.VT[I]);
        p.VT[self]++; 
        e.VT = p.VT;
        if e is sending message m, 
            m.VT = p.VT;

Vector-Clock-Timestamps