bt2: Adapt test_clock_class.py and make it pass
[babeltrace.git] / bindings / python / bt2 / bt2 / component.py
index fcd50785dcfef57f6ebcb950aed0c9c673c47b58..e500c982649feb1915611901e06fb264bf1b0310 100644 (file)
@@ -641,6 +641,39 @@ class _UserComponent(metaclass=_UserComponentType):
 
         return tc
 
+    def _create_clock_class(self, frequency=None, name=None, description=None,
+                            precision=None, offset=None, origin_is_unix_epoch=True,
+                            uuid=None):
+        ptr = self._as_self_component_ptr(self._ptr)
+        cc_ptr = native_bt.clock_class_create(ptr)
+
+        if cc_ptr is None:
+            raise bt2.CreationError('could not create clock class')
+
+        cc = bt2.clock_class._ClockClass._create_from_ptr(cc_ptr)
+
+        if frequency is not None:
+            cc._frequency = frequency
+
+        if name is not None:
+            cc._name = name
+
+        if description is not None:
+            cc._description = description
+
+        if precision is not None:
+            cc._precision = precision
+
+        if offset is not None:
+            cc._offset = offset
+
+        cc._origin_is_unix_epoch = origin_is_unix_epoch
+
+        if uuid is not None:
+            cc._uuid = uuid
+
+        return cc
+
 
 class _UserSourceComponent(_UserComponent, _SourceComponent):
     _as_not_self_specific_component_ptr = staticmethod(native_bt.self_component_source_as_component_source)
This page took 0.026417 seconds and 4 git commands to generate.