Implement bt_ctf_clock_value interface
[babeltrace.git] / include / babeltrace / ctf-ir / clock.h
index e149d7fadb684f7ce0da904498ea62eb33cc9f0b..2bd1924bfe771408d2002ab077cb7e2c842e9878 100644 (file)
@@ -37,13 +37,15 @@ extern "C" {
 #endif
 
 struct bt_ctf_clock;
+struct bt_ctf_clock_value;
 
 /*
  * bt_ctf_clock_create: create a clock.
  *
  * Allocate a new clock setting its reference count to 1.
  *
- * @param name Name of the clock (will be copied).
+ * @param name Name of the clock (will be copied); can be set to NULL
+ *             for nameless clocks.
  *
  * Returns an allocated clock on success, NULL on error.
  */
@@ -60,6 +62,17 @@ extern struct bt_ctf_clock *bt_ctf_clock_create(const char *name);
  */
 extern const char *bt_ctf_clock_get_name(struct bt_ctf_clock *clock);
 
+/*
+ * bt_ctf_clock_set_name: set a clock's name.
+ *
+ * Set a clock's name.
+ *
+ * @param name Name of the clock (will be copied).
+ *
+ * Returns 0 on success, a negative value on error.
+ */
+extern int bt_ctf_clock_set_name(struct bt_ctf_clock *clock, const char *name);
+
 /*
  * bt_ctf_clock_get_description: get a clock's description.
  *
@@ -237,49 +250,14 @@ extern const unsigned char *bt_ctf_clock_get_uuid(struct bt_ctf_clock *clock);
 extern int bt_ctf_clock_set_uuid(struct bt_ctf_clock *clock,
                const unsigned char *uuid);
 
-/*
- * bt_ctf_clock_get_time: get a clock's current time value.
- *
- * Get the current time in nanoseconds since the clock's origin (offset and
- * offset_s attributes).
- *
- * @param clock Clock instance.
- * @param time Clock current time value (output).
- *
- * Returns 0 on success, a negative value on error.
- */
-extern int bt_ctf_clock_get_time(struct bt_ctf_clock *clock,
-               int64_t *time);
+extern struct bt_ctf_clock_value *bt_ctf_clock_value_create(
+               struct bt_ctf_clock *clock, uint64_t value);
 
-/*
- * bt_ctf_clock_set_time: set a clock's current time value.
- *
- * Set the current time in nanoseconds since the clock's origin (offset and
- * offset_s attributes). Defaults to 0.
- *
- * Returns 0 on success, a negative value on error.
- */
-extern int bt_ctf_clock_set_time(struct bt_ctf_clock *clock,
-               int64_t time);
+extern int bt_ctf_clock_value_get_value(
+               struct bt_ctf_clock_value *clock_value, uint64_t *raw_value);
 
-/*
- * bt_ctf_clock_get and bt_ctf_clock_put: increment and decrement the
- * refcount of the clock
- *
- * You may also use bt_ctf_get() and bt_ctf_put() with clock objects.
- *
- * These functions ensure that the clock won't be destroyed when it
- * is in use. The same number of get and put (plus one extra put to
- * release the initial reference done at creation) has to be done to
- * destroy a clock.
- *
- * When the clock refcount is decremented to 0 by a bt_ctf_clock_put,
- * the clock is freed.
- *
- * @param clock Clock instance.
- */
-extern void bt_ctf_clock_get(struct bt_ctf_clock *clock);
-extern void bt_ctf_clock_put(struct bt_ctf_clock *clock);
+extern int bt_ctf_clock_value_get_value_ns_from_epoch(
+               struct bt_ctf_clock_value, int64_t *value_ns);
 
 #ifdef __cplusplus
 }
This page took 0.024655 seconds and 4 git commands to generate.