struct bt_ctf_event_class *event_class, size_t index);
struct bt_ctf_field_type *_bt_python_ctf_event_class_get_field_type(
struct bt_ctf_event_class *event_class, size_t index);
+int _bt_python_ctf_clock_get_uuid_index(struct bt_ctf_clock *clock,
+ size_t index, unsigned char *OUTPUT);
+int _bt_python_ctf_clock_set_uuid_index(struct bt_ctf_clock *clock,
+ size_t index, unsigned char value);
/* =================================================================
CONTEXT.H, CONTEXT-INTERNAL.H
void bt_ctf_writer_put(struct bt_ctf_writer *writer);
%pythoncode %{
+import uuid
class CTFWriter:
# Used to compare to -1ULL in error checks
if ret < 0:
raise ValueError("Could not set the clock's absolute attribute.")
+ """
+ Get a clock's UUID (an object of type UUID).
+ """
+ @property
+ def uuid(self):
+ uuid_list = []
+ for i in range(16):
+ ret, value = _bt_python_ctf_clock_get_uuid_index(self._c, i)
+ if ret < 0:
+ raise ValueError("Invalid clock instance")
+ uuid_list.append(value)
+ return uuid.UUID(bytes=bytes(uuid_list))
+
+ """
+ Set a clock's UUID (an object of type UUID).
+ """
+ @uuid.setter
+ def uuid(self, uuid):
+ uuid_bytes = uuid.bytes
+ if len(uuid_bytes) != 16:
+ raise ValueError("Invalid UUID provided. UUID length must be 16 bytes")
+ for i in range(len(uuid_bytes)):
+ ret = _bt_python_ctf_clock_set_uuid_index(self._c, i, uuid_bytes[i])
+ if ret < 0:
+ raise ValueError("Invalid clock instance")
+
"""
Get the current time in nanoseconds since the clock's origin (offset and
offset_s attributes).