+ return -1ULL;
+}
+
+uint64_t bt_ctf_get_timestamp(struct bt_ctf_event *event)
+{
+ uint64_t ts_nsec;
+ struct ctf_trace *trace;
+ struct trace_collection *tc;
+ uint64_t tc_offset;
+ uint64_t timestamp;
+
+ if (!event->stream->has_timestamp) {
+ return -1ULL;
+ }
+
+ trace = event->stream->stream_class->trace;
+ tc = trace->collection;
+ tc_offset = tc->single_clock_offset_avg;
+ timestamp = event->stream->timestamp;
+ if (event->stream->current_clock->freq == 1000000000ULL) {
+ ts_nsec = timestamp;
+ } else {
+ ts_nsec = (uint64_t) ((double) timestamp * 1000000000.0
+ / (double) event->stream->current_clock->freq);
+ }
+ ts_nsec += tc_offset;
+
+ return ts_nsec;