From: Mathieu Desnoyers Date: Fri, 9 Mar 2012 23:26:09 +0000 (-0500) Subject: Fix: seek by timestamp X-Git-Tag: v1.0.0-pre4~7 X-Git-Url: http://drtracing.org/?a=commitdiff_plain;h=48d5f76c4831624cb4332c7707c2615c2474284c;p=babeltrace.git 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 --- 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);