aboutsummaryrefslogtreecommitdiffstats
path: root/util/lamport.go
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2018-08-06 20:31:20 +0200
committerMichael Muré <batolettre@gmail.com>2018-08-06 20:31:20 +0200
commit435be2b693aee89ed34a2d1e7291b3b141b19717 (patch)
tree89244a9dcb995c27002995e9f25f9be631101713 /util/lamport.go
parent593891b8e01fd89866b30854a60aece1dad5f6ab (diff)
downloadgit-bug-435be2b693aee89ed34a2d1e7291b3b141b19717.tar.gz
bug: add a Lamport logical clock to be able to sort bugs by creation time and edit time without having to rely on a timestamp
Diffstat (limited to 'util/lamport.go')
-rw-r--r--util/lamport.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/util/lamport.go b/util/lamport.go
index c75e1d15..4d5dcf5b 100644
--- a/util/lamport.go
+++ b/util/lamport.go
@@ -58,9 +58,9 @@ func (l *LamportClock) Time() LamportTime {
return LamportTime(atomic.LoadUint64(&l.counter))
}
-// Increment is used to increment and return the value of the lamport clock
+// Increment is used to return the value of the lamport clock and increment it afterwards
func (l *LamportClock) Increment() LamportTime {
- return LamportTime(atomic.AddUint64(&l.counter, 1))
+ return LamportTime(atomic.AddUint64(&l.counter, 1) - 1)
}
// Witness is called to update our local clock if necessary after