mirror of
https://github.com/subsurface/subsurface.git
synced 2024-12-03 15:43:09 +00:00
core: fix sorting of events
Fix an embarrassing bug: the less than operator for events was wrong. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
01705a6449
commit
bdfd37c95b
1 changed files with 2 additions and 5 deletions
|
@ -287,11 +287,8 @@ void fixup_dc_duration(struct divecomputer &dc)
|
||||||
|
|
||||||
static bool operator<(const event &ev1, const event &ev2)
|
static bool operator<(const event &ev1, const event &ev2)
|
||||||
{
|
{
|
||||||
if (ev1.time.seconds < ev2.time.seconds)
|
return std::tie(ev1.time.seconds, ev1.name) <
|
||||||
return -1;
|
std::tie(ev2.time.seconds, ev2.name);
|
||||||
if (ev1.time.seconds > ev2.time.seconds)
|
|
||||||
return 1;
|
|
||||||
return ev1.name < ev2.name;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int add_event_to_dc(struct divecomputer *dc, struct event ev)
|
int add_event_to_dc(struct divecomputer *dc, struct event ev)
|
||||||
|
|
Loading…
Reference in a new issue