[PATCH] Retain event sort order on restart

Miika Turkia miika.turkia at gmail.com
Sun Apr 21 21:00:40 PDT 2013


The events that had same time stamp were reversed in order on every new
load of the log file. This patch will keep the order static. (Changing
order is annoying when using version control to store the logs.)

Signed-off-by: Miika Turkia <miika.turkia at gmail.com>
---
 dive.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/dive.c b/dive.c
index 4612184..34025d6 100644
--- a/dive.c
+++ b/dive.c
@@ -25,7 +25,7 @@ void add_event(struct divecomputer *dc, int time, int type, int flags, int value
 	p = &dc->events;
 
 	/* insert in the sorted list of events */
-	while (*p && (*p)->time.seconds < time)
+	while (*p && (*p)->time.seconds <= time)
 		p = &(*p)->next;
 	ev->next = *p;
 	*p = ev;
-- 
1.7.9.5



More information about the subsurface mailing list