*/
extern struct bt_ctf_clock *bt_ctf_clock_create(const char *name);
+extern struct bt_ctf_clock *bt_ctf_clock_create_empty(void);
+
+extern int bt_ctf_clock_set_name(struct bt_ctf_clock *clock, const char *name);
+
/*
* bt_ctf_clock_get_name: get a clock's name.
*
* Get the clock's offset in seconds from POSIX.1 Epoch, 1970-01-01.
*
* @param clock Clock instance.
+ * @param offset_s Pointer to clock offset in seconds (output).
*
- * Returns the clock's offset in seconds, -1ULL on error.
+ * Returns 0 on success, a negative value on error.
*/
-extern uint64_t bt_ctf_clock_get_offset_s(struct bt_ctf_clock *clock);
+extern int bt_ctf_clock_get_offset_s(struct bt_ctf_clock *clock,
+ int64_t *offset_s);
/*
* bt_ctf_clock_set_offset_s: set a clock's offset in seconds.
* Returns 0 on success, a negative value on error.
*/
extern int bt_ctf_clock_set_offset_s(struct bt_ctf_clock *clock,
- uint64_t offset_s);
+ int64_t offset_s);
/*
- * bt_ctf_clock_get_offset_s: get a clock's offset in ticks.
+ * bt_ctf_clock_get_offset: get a clock's offset in ticks.
*
* Get the clock's offset in ticks from Epoch + offset_t.
*
* @param clock Clock instance.
+ * @param offset Clock offset in ticks from Epoch + offset_s (output).
*
- * Returns the clock's offset in ticks from Epoch + offset_s, -1ULL on error.
+ * Returns 0 on success, a negative value on error.
*/
-extern uint64_t bt_ctf_clock_get_offset(struct bt_ctf_clock *clock);
+extern int bt_ctf_clock_get_offset(struct bt_ctf_clock *clock,
+ int64_t *offset);
/*
* bt_ctf_clock_set_offset: set a clock's offset in ticks.
* Returns 0 on success, a negative value on error.
*/
extern int bt_ctf_clock_set_offset(struct bt_ctf_clock *clock,
- uint64_t offset);
+ int64_t offset);
/*
* bt_ctf_clock_get_is_absolute: get a clock's absolute attribute.
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).
- *
- * Returns the clock's current time value, -1ULL on error.
- */
-extern uint64_t bt_ctf_clock_get_time(struct bt_ctf_clock *clock);
-
-/*
- * 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,
- uint64_t time);
-
-/*
- * bt_ctf_clock_get and bt_ctf_clock_put: increment and decrement the
- * refcount of the clock
- *
- * 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 int64_t bt_ctf_clock_ns_from_value(struct bt_ctf_clock *clock,
+ uint64_t value);
#ifdef __cplusplus
}