Support for --clock-offset and --clock-offset-ns
[babeltrace.git] / plugins / ctf / fs / metadata.c
index e531056c91fadb2769d2ba0483e8cfbb4464f3ba..5c64113c3b5d7eef3f3b9e2b478ae8151ecbd427 100644 (file)
@@ -43,6 +43,8 @@
 
 #define TSDL_MAGIC     0x75d11d57
 
+#define NSEC_PER_SEC 1000000000LL
+
 struct packet_header {
        uint32_t magic;
        uint8_t  uuid[16];
@@ -313,7 +315,7 @@ end:
        return ret;
 }
 
-void ctf_fs_metadata_set_trace(struct ctf_fs_component *ctf_fs)
+int ctf_fs_metadata_set_trace(struct ctf_fs_component *ctf_fs)
 {
        int ret = 0;
        struct ctf_fs_file *file = get_file(ctf_fs, ctf_fs->trace_path->str);
@@ -398,7 +400,9 @@ void ctf_fs_metadata_set_trace(struct ctf_fs_component *ctf_fs)
        }
 
        ret = ctf_visitor_generate_ir(ctf_fs->error_fp, &scanner->ast->root,
-               &ctf_fs->metadata->trace);
+               &ctf_fs->metadata->trace,
+               ctf_fs->options.clock_offset * NSEC_PER_SEC +
+               ctf_fs->options.clock_offset_ns);
        if (ret) {
                PERR("Cannot create trace object from metadata AST\n");
                goto error;
@@ -412,6 +416,8 @@ error:
                ctf_fs->metadata->text = NULL;
        }
 
+       ret = -1;
+
 end:
        if (file) {
                ctf_fs_file_destroy(file);
@@ -420,6 +426,8 @@ end:
        if (scanner) {
                ctf_scanner_free(scanner);
        }
+
+       return ret;
 }
 
 int ctf_fs_metadata_init(struct ctf_fs_metadata *metadata)
This page took 0.036891 seconds and 4 git commands to generate.