+ /*
+ * Look for a "timestamp" field in the stream class' event header type
+ * and map the stream's clock to that field if no current mapping is
+ * currently set.
+ */
+ timestamp_field = bt_ctf_field_type_structure_get_field_type_by_name(
+ stream_class->event_header_type, "timestamp");
+ if (timestamp_field) {
+ struct bt_ctf_clock *mapped_clock;
+
+ mapped_clock = bt_ctf_field_type_integer_get_mapped_clock(
+ timestamp_field);
+ if (mapped_clock) {
+ bt_ctf_clock_put(mapped_clock);
+ goto end;
+ }
+
+ ret = bt_ctf_field_type_integer_set_mapped_clock(
+ timestamp_field, clock);
+ if (ret) {
+ goto end;
+ }
+ }
+