Handle negative time and offset from Epoch
[babeltrace.git] / formats / ctf / events.c
index ea47a40355940d9707129e433a6246832c82ee17..f336dd88b743b7bdbb9bd6e21a78d180dc0a584e 100644 (file)
@@ -255,7 +255,7 @@ int bt_ctf_get_field_list(const struct bt_ctf_event *ctf_event,
                        goto error;
                if (def_sequence->elems->pdata) {
                        *list = (struct bt_definition const* const*) def_sequence->elems->pdata;
-                       *count = def_sequence->elems->len;
+                       *count = (unsigned int) def_sequence->length->value._unsigned;
                        goto end;
                } else {
                        goto error;
@@ -315,18 +315,19 @@ int bt_ctf_event_get_handle_id(const struct bt_ctf_event *ctf_event)
        return ret;
 }
 
-uint64_t bt_ctf_get_timestamp(const struct bt_ctf_event *ctf_event)
+int bt_ctf_get_timestamp(const struct bt_ctf_event *ctf_event, int64_t *timestamp)
 {
        const struct ctf_event_definition *event;
 
-       if (!ctf_event)
-               return -1ULL;
+       if (!ctf_event || !timestamp)
+               return -1;
 
        event = ctf_event->parent;
        if (event && event->stream->has_timestamp)
-               return event->stream->real_timestamp;
+               *timestamp = event->stream->real_timestamp;
        else
-               return -1ULL;
+               return -1;
+       return 0;
 }
 
 uint64_t bt_ctf_get_cycles(const struct bt_ctf_event *ctf_event)
This page took 0.024651 seconds and 4 git commands to generate.