#define BT_LOG_TAG "CLOCK-CLASS"
#include <babeltrace/lib-logging-internal.h>
+#include <babeltrace/compat/uuid-internal.h>
#include <babeltrace/ctf-ir/clock-class-internal.h>
#include <babeltrace/ctf-ir/utils.h>
#include <babeltrace/ref.h>
}
}
- ret = bt_uuid_generate(clock_class->uuid);
- if (ret) {
- BT_LOGE_STR("Failed to generate a UUID.");
- goto error;
- }
-
- clock_class->uuid_set = 1;
BT_LOGD("Created clock class object: addr=%p, name=\"%s\"",
clock_class, name);
return clock_class;
#include <babeltrace/ctf-ir/clock-class.h>
#include <babeltrace/ctf-ir/clock-class-internal.h>
#include <babeltrace/ctf-ir/utils.h>
+#include <babeltrace/compat/uuid-internal.h>
#include <babeltrace/ref.h>
#include <babeltrace/object-internal.h>
#include <babeltrace/compiler-internal.h>
struct bt_ctf_clock *bt_ctf_clock_create(const char *name)
{
+ int ret;
struct bt_ctf_clock *clock = NULL;
+ unsigned char cc_uuid[BABELTRACE_UUID_LEN];
if (!name) {
goto error;
if (!clock->clock_class) {
goto error;
}
+
+ /* Automatically set clock class's UUID. */
+ ret = bt_uuid_generate(cc_uuid);
+ if (ret) {
+ goto error;
+ }
+
+ ret = bt_ctf_clock_class_set_uuid(clock->clock_class, cc_uuid);
+ assert(ret == 0);
return clock;
error: