(i, j int)
| 7 | } |
| 8 | |
| 9 | func (b BugsByCreationTime) Less(i, j int) bool { |
| 10 | if b[i].CreateLamportTime() < b[j].CreateLamportTime() { |
| 11 | return true |
| 12 | } |
| 13 | |
| 14 | if b[i].CreateLamportTime() > b[j].CreateLamportTime() { |
| 15 | return false |
| 16 | } |
| 17 | |
| 18 | // When the logical clocks are identical, that means we had a concurrent |
| 19 | // edition. In this case we rely on the timestamp. While the timestamp might |
| 20 | // be incorrect due to a badly set clock, the drift in sorting is bounded |
| 21 | // by the first sorting using the logical clock. That means that if users |
| 22 | // synchronize their bugs regularly, the timestamp will rarely be used, and |
| 23 | // should still provide a kinda accurate sorting when needed. |
| 24 | return b[i].FirstOp().Time().Before(b[j].FirstOp().Time()) |
| 25 | } |
| 26 | |
| 27 | func (b BugsByCreationTime) Swap(i, j int) { |
| 28 | b[i], b[j] = b[j], b[i] |
nothing calls this directly
no test coverage detected