summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/seq.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/seq.c b/src/seq.c
index eca1144..de56508 100644
--- a/src/seq.c
+++ b/src/seq.c
@@ -65,6 +65,18 @@ static xas_seq_event *event_tail(xas_seq_event *head) {
return head;
}
+static inline int event_lt(xas_seq_event *a, xas_seq_event *b) {
+ if (timercmp(&a->timestamp, &b->timestamp, <)) {
+ return 1;
+ } else if (!timercmp(&a->timestamp, &b->timestamp, !=)) {
+ if (a->type < b->type) {
+ return 1;
+ }
+ }
+
+ return 0;
+}
+
static xas_seq_event *event_list_partition(xas_seq_event *head,
xas_seq_event *end,
xas_seq_event **head_new,
@@ -75,7 +87,7 @@ static xas_seq_event *event_list_partition(xas_seq_event *head,
*tail = pivot;
while (cur != pivot) {
- if (timercmp(&cur->timestamp, &pivot->timestamp, <)) {
+ if (event_lt(cur, pivot)) {
if (*head_new == NULL) {
*head_new = cur;
}