- unsigned char *uuid;
-
- if (!clock_class || !context) {
- return;
- }
-
- uuid = clock_class->uuid;
- g_string_append(context->string, "clock {\n");
- g_string_append_printf(context->string, "\tname = %s;\n",
- clock_class->name->str);
- g_string_append_printf(context->string,
- "\tuuid = \"%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x\";\n",
- uuid[0], uuid[1], uuid[2], uuid[3],
- uuid[4], uuid[5], uuid[6], uuid[7],
- uuid[8], uuid[9], uuid[10], uuid[11],
- uuid[12], uuid[13], uuid[14], uuid[15]);
- if (clock_class->description) {
- g_string_append_printf(context->string, "\tdescription = \"%s\";\n",
- clock_class->description->str);
- }
-
- g_string_append_printf(context->string, "\tfreq = %" PRIu64 ";\n",
- clock_class->frequency);
- g_string_append_printf(context->string, "\tprecision = %" PRIu64 ";\n",
- clock_class->precision);
- g_string_append_printf(context->string, "\toffset_s = %" PRIu64 ";\n",
- clock_class->offset_s);
- g_string_append_printf(context->string, "\toffset = %" PRIu64 ";\n",
- clock_class->offset);
- g_string_append_printf(context->string, "\tabsolute = %s;\n",
- clock_class->absolute ? "TRUE" : "FALSE");
- g_string_append(context->string, "};\n\n");
+ BT_ASSERT_PRE_NON_NULL(clock_class, "Clock class");
+ BT_ASSERT_PRE_CLOCK_CLASS_HOT(clock_class);
+ BT_ASSERT_PRE(cycles < clock_class->frequency,
+ "Offset (cycles) is greater than clock class's frequency: "
+ "%![cc-]+K, new-offset-cycles=%" PRIu64, clock_class, cycles);
+ clock_class->offset_seconds = seconds;
+ clock_class->offset_cycles = cycles;
+ set_base_offset(clock_class);
+ BT_LIB_LOGV("Set clock class's offset: %!+K", clock_class);
+ return 0;