Python bindings: add has_intersection property to TraceCollection
[babeltrace.git] / include / babeltrace / clock-internal.h
index 002cc7fd848bd26c291c298ac22ce7ff33ee7b56..cd6bdbae03b9d2ecc8ad7f04142378cf280b0a95 100644 (file)
@@ -42,4 +42,17 @@ uint64_t clock_cycles_to_ns(struct ctf_clock *clock, uint64_t cycles)
        }
 }
 
+/*
+ * 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 */
This page took 0.0236 seconds and 4 git commands to generate.