From: Michael Tremer Date: Wed, 29 Oct 2025 14:45:26 +0000 (+0000) Subject: client: Send --since= and --until X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c431a8035c63ba9158eea561b2b8acab1651f89d;p=telemetry.git client: Send --since= and --until Signed-off-by: Michael Tremer --- diff --git a/src/client/main.c b/src/client/main.c index 957b098..23e2166 100644 --- a/src/client/main.c +++ b/src/client/main.c @@ -55,18 +55,30 @@ typedef struct td_client_ctx { uint64_t h; uint64_t w; } dimensions; + + // Interval + struct { + const char* since; + const char* until; + } interval; } td_client_ctx; enum { OPT_FORMAT = 1, OPT_HEIGHT = 2, OPT_WIDTH = 3, + OPT_SINCE = 4, + OPT_UNTIL = 5, }; static struct argp_option options[] = { { "format", OPT_FORMAT, "FORMAT", 0, "Output Format", 0 }, { "height", OPT_HEIGHT, "PIXELS", 0, "Height of the output image", 1 }, { "width", OPT_WIDTH, "PIXELS", 0, "Width of the output image", 1 }, + + // Time + { "since", OPT_SINCE, "TIMESTAMP", 0, "Start the graph from the specified date", 0 }, + { "until", OPT_UNTIL, "TIMESTAMP", 0, "End the graph at the specified date", 0 }, { NULL }, }; @@ -97,6 +109,14 @@ static error_t parse(int key, char* arg, struct argp_state* state) { break; + case OPT_SINCE: + ctx->interval.since = arg; + break; + + case OPT_UNTIL: + ctx->interval.until = arg; + break; + // Called for each argument case ARGP_KEY_ARG: // Take the graph name as first argument