mirror of
https://github.com/MichaelMure/git-bug.git
synced 2024-12-14 08:45:30 +03:00
lamport: match wikipedia algorithm
This commit is contained in:
parent
956f98b676
commit
44d7587940
@ -11,7 +11,7 @@ func testClock(t *testing.T, c Clock) {
|
||||
|
||||
val, err := c.Increment()
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, Time(1), val)
|
||||
assert.Equal(t, Time(2), val)
|
||||
assert.Equal(t, Time(2), c.Time())
|
||||
|
||||
err = c.Witness(41)
|
||||
|
@ -62,7 +62,7 @@ func (mc *MemClock) Time() Time {
|
||||
|
||||
// Increment is used to return the value of the lamport clock and increment it afterwards
|
||||
func (mc *MemClock) Increment() (Time, error) {
|
||||
return Time(atomic.AddUint64(&mc.counter, 1) - 1), nil
|
||||
return Time(atomic.AddUint64(&mc.counter, 1)), nil
|
||||
}
|
||||
|
||||
// Witness is called to update our local clock if necessary after
|
||||
|
Loading…
Reference in New Issue
Block a user