]> git.ipfire.org Git - oddments/collecty.git/commitdiff
graphs: Implement adjusting the interval
authorMichael Tremer <michael.tremer@ipfire.org>
Wed, 29 Oct 2025 14:45:55 +0000 (14:45 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Wed, 29 Oct 2025 14:45:55 +0000 (14:45 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/daemon/graph.c
src/daemon/graph.h

index 0d39924751306326cec83e9664692cc16bf8539b..53d2e4a3b45c8cff7c07f0dd54d81f185ab04139 100644 (file)
@@ -284,6 +284,20 @@ int td_graph_render(td_graph* self, const char* object,
                        goto ERROR;
        }
 
+       // Pass the start time
+       if (options->interval.t_start) {
+               r = td_args_push(args, "--start=%ld", options->interval.t_start);
+               if (r < 0)
+                       goto ERROR;
+       }
+
+       // Pass the end time
+       if (options->interval.t_end) {
+               r = td_args_push(args, "--end=%ld", options->interval.t_end);
+               if (r < 0)
+                       goto ERROR;
+       }
+
        // Set the title
        if (self->impl->title) {
                // Fetch the title
index 6e27707bea06902ada94bb4a6cbcb16ff600012e..89e631942806042d3f9b921e75720ad36ca78bd5 100644 (file)
@@ -78,6 +78,12 @@ typedef struct td_graph_render_options {
                unsigned int h;
                unsigned int w;
        } dimensions;
+
+       // Interval
+       struct {
+               time_t t_start;
+               time_t t_end;
+       } interval;
 } td_graph_render_options;
 
 int td_graph_render(td_graph* self, const char* object,