From 48d5f76c4831624cb4332c7707c2615c2474284c Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Fri, 9 Mar 2012 18:26:09 -0500 Subject: [PATCH 1/1] Fix: seek by timestamp When seeking a stream by timestamp, we need to match the first packet in the stream that is at (or after) the timestamp to seek to. Failure to do so is a bug: if we have many streams, and seek all streams to a timestamp that is after the start time of some of the streams, those late comers will show no events. Reported-by: Yannick Brosseau Signed-off-by: Mathieu Desnoyers --- lib/iterator.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/iterator.c b/lib/iterator.c index 686ddb1b..0af15140 100644 --- a/lib/iterator.c +++ b/lib/iterator.c @@ -110,8 +110,7 @@ static int seek_file_stream_by_timestamp(struct ctf_file_stream *cfs, for (i = 0; i < stream_pos->packet_index->len; i++) { index = &g_array_index(stream_pos->packet_index, struct packet_index, i); - if (index->timestamp_begin >= timestamp || - index->timestamp_end <= timestamp) + if (index->timestamp_end <= timestamp) continue; stream_pos->packet_seek(&stream_pos->parent, i, SEEK_SET); -- 2.34.1