All stream clocks with a Unix epoch origin, whatever their
\link api-tir-clock-cls-prop-iden identity\endlink,
have a correlation.
+
+ Check whether or not two clock classes share the same identity
+ with bt_clock_class_has_same_identity().
</dd>
<dt>
All stream clocks with the same custom origin, whatever their
\link api-tir-clock-cls-prop-iden identity\endlink,
have a correlation.
+
+ Check whether or not two clock classes share the same identity
+ with bt_clock_class_has_same_identity().
</dd>
</dl>
extern const char *
bt_clock_class_get_uid(const bt_clock_class *clock_class) __BT_NOEXCEPT;
+/*!
+@brief
+ Returns whether or not the clock classes \bt_p{clock_class_a}
+ and \bt_p{clock_class_b} share the same identity.
+
+See the \ref api-tir-clock-cls-prop-iden "identity" property.
+
+Two clock classes share the same identity when all the following are
+true:
+
+- They both have a name and a UID.
+
+- The values of their namespace, name, and UID property tuples
+ are the same.
+
+@param[in] clock_class_a
+ Clock class A.
+@param[in] clock_class_b
+ Clock class B.
+
+@returns
+ #BT_TRUE if \bt_p{clock_class_a} and \bt_p{clock_class_b} share
+ the same identity
+
+@bt_pre_not_null{clock_class_a}
+@bt_pre_clock_cls_with_mip{clock_class_a, 1}
+@bt_pre_not_null{clock_class_b}
+@bt_pre_clock_cls_with_mip{clock_class_b, 1}
+*/
+extern bt_bool bt_clock_class_has_same_identity(
+ const bt_clock_class *clock_class_a,
+ const bt_clock_class *clock_class_b) __BT_NOEXCEPT;
+
/*!
@brief
Status codes for bt_clock_class_set_description().
return ret;
}
+BT_EXPORT
+bt_bool bt_clock_class_has_same_identity(
+ const bt_clock_class *cc_a,
+ const bt_clock_class *cc_b)
+{
+ BT_ASSERT_PRE_DEV_CLK_CLS_NON_NULL(cc_a);
+ BT_ASSERT_PRE_DEV_CLK_CLS_NON_NULL(cc_b);
+ BT_ASSERT_PRE_CC_MIP_VERSION_GE(cc_a, 1);
+ BT_ASSERT_PRE_CC_MIP_VERSION_GE(cc_b, 1);
+
+ bt_bool is_same = BT_FALSE;
+
+ if (g_strcmp0(cc_a->ns, cc_b->ns) != 0) {
+ goto end;
+ }
+
+ if (!cc_a->name || !cc_b->name || strcmp(cc_a->name, cc_b->name) != 0) {
+ goto end;
+ }
+
+ if (!cc_a->uid || !cc_b->uid || strcmp(cc_a->uid, cc_b->uid) != 0) {
+ goto end;
+ }
+
+ is_same = BT_TRUE;
+
+end:
+ return is_same;
+}
+
BT_EXPORT
const struct bt_value *bt_clock_class_borrow_user_attributes_const(
const struct bt_clock_class *clock_class)