+int64_t get_raw_timestamp(struct bt_ctf_packet *writer_packet,
+ int64_t timestamp)
+{
+ struct bt_ctf_clock_class *writer_clock_class;
+ int64_t sec_offset, cycles_offset, ns;
+ struct bt_ctf_trace *writer_trace;
+ struct bt_ctf_stream *writer_stream;
+ struct bt_ctf_stream_class *writer_stream_class;
+ int ret;
+ uint64_t freq;
+
+ writer_stream = bt_ctf_packet_get_stream(writer_packet);
+ assert(writer_stream);
+
+ writer_stream_class = bt_ctf_stream_get_class(writer_stream);
+ assert(writer_stream_class);
+
+ writer_trace = bt_ctf_stream_class_get_trace(writer_stream_class);
+ assert(writer_trace);
+
+ /* FIXME multi-clock? */
+ writer_clock_class = bt_ctf_trace_get_clock_class_by_index(
+ writer_trace, 0);
+ assert(writer_clock_class);
+
+ ret = bt_ctf_clock_class_get_offset_s(writer_clock_class, &sec_offset);
+ assert(!ret);
+ ns = sec_offset * NSEC_PER_SEC;
+
+ freq = bt_ctf_clock_class_get_frequency(writer_clock_class);
+ assert(freq != -1ULL);
+
+ ret = bt_ctf_clock_class_get_offset_cycles(writer_clock_class, &cycles_offset);
+ assert(!ret);
+
+ ns += ns_from_value(freq, cycles_offset);
+
+ bt_put(writer_clock_class);
+ bt_put(writer_trace);
+ bt_put(writer_stream_class);
+ bt_put(writer_stream);
+
+ return timestamp - ns;
+}
+
+static
+struct bt_notification *evaluate_packet_notification(