if (tc->clock_use_offset_avg)
tc_offset = tc->single_clock_offset_avg;
else
- tc_offset = trace->parent.single_clock->offset;
+ tc_offset = clock_offset_ns(trace->parent.single_clock);
ts_nsec = clock_cycles_to_ns(stream->current_clock, timestamp);
ts_nsec += tc_offset; /* Add offset */
}
}
+/*
+ * Note: if using a frequency different from 1GHz for clock->offset, it
+ * is recommended to express the seconds in offset_s, otherwise there
+ * will be a loss of precision caused by the limited size of the double
+ * mantissa.
+ */
+static inline
+uint64_t clock_offset_ns(struct ctf_clock *clock)
+{
+ return clock->offset_s * 1000000000ULL
+ + clock_cycles_to_ns(clock, clock->offset);
+}
+
#endif /* _BABELTRACE_CLOCK_INTERNAL_H */
}
}
-/*
- * Note: if using a frequency different from 1GHz for clock->offset, it
- * is recommended to express the seconds in offset_s, otherwise there
- * will be a loss of precision caused by the limited size of the double
- * mantissa.
- */
-static
-uint64_t clock_offset_ns(struct ctf_clock *clock)
-{
- return clock->offset_s * 1000000000ULL
- + clock_cycles_to_ns(clock, clock->offset);
-}
-
static void clock_add(gpointer key, gpointer value, gpointer user_data)
{
struct clock_match *clock_match = user_data;