From: Michael Tremer Date: Thu, 6 Nov 2025 22:45:07 +0000 (+0000) Subject: graphs: Fix rendering time calculation X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=adb949d50eea39a765ba95bb85260998186e272d;p=telemetry.git graphs: Fix rendering time calculation Signed-off-by: Michael Tremer --- diff --git a/src/daemon/graph.c b/src/daemon/graph.c index 1c400ef..4042b96 100644 --- a/src/daemon/graph.c +++ b/src/daemon/graph.c @@ -479,7 +479,7 @@ int td_graph_render(td_graph* self, const char* object, // Log action DEBUG(self->ctx, "Rendered graph %s in %.2fms:\n", td_graph_get_name(self), - USEC_TO_MSEC((double)(t_end - t_start / CLOCKS_PER_SEC))); + SEC_TO_MSEC((double)(t_end - t_start) / CLOCKS_PER_SEC)); DEBUG(self->ctx, " size : %d byte(s)\n", ftell(f)); DEBUG(self->ctx, " width : %d\n", w); DEBUG(self->ctx, " height : %d\n", h); diff --git a/src/daemon/time.h b/src/daemon/time.h index 2409c0b..6199023 100644 --- a/src/daemon/time.h +++ b/src/daemon/time.h @@ -24,7 +24,7 @@ #include // Seconds to milliseconds -#define SEC_TO_MSEC(s) ((s) * 1000UL) +#define SEC_TO_MSEC(s) ((s) * 1000.0) // Seconds to microseconds #define SEC_TO_USEC(s) ((s) * 1000000UL)