src.ctf.fs: trace-info: omit stream `range-ns` field when no TS
[babeltrace.git] / plugins / ctf / fs-src / query.c
index 0ddd4186a04033e4cf3511c5b9e58a09eb9021f6..e2018b157a0aef746e6d1c7ea85781bd992dd8a0 100644 (file)
@@ -313,13 +313,18 @@ int populate_stream_info(struct ctf_fs_ds_file_group *group,
 
        stream_range->begin_ns = first_ds_index_entry->timestamp_begin_ns;
        stream_range->end_ns = last_ds_index_entry->timestamp_end_ns;
-       stream_range->set = true;
 
-       if (stream_range->set) {
-               ret = add_range(group_info, stream_range, "range-ns");
-               if (ret) {
-                       goto end;
-               }
+       /*
+        * If any of the begin and end timestamps is not set it means that
+        * packets don't include `timestamp_begin` _and_ `timestamp_end` fields
+        * in their packet context so we can't set the range.
+        */
+       stream_range->set = stream_range->begin_ns != UINT64_C(-1) &&
+               stream_range->end_ns != UINT64_C(-1);
+
+       ret = add_range(group_info, stream_range, "range-ns");
+       if (ret) {
+               goto end;
        }
 
        status = bt_value_map_insert_entry(group_info, "paths",
This page took 0.02513 seconds and 4 git commands to generate.