]> git.ipfire.org Git - oddments/collecty.git/commitdiff
graphs: Fix rendering time calculation
authorMichael Tremer <michael.tremer@ipfire.org>
Thu, 6 Nov 2025 22:45:07 +0000 (22:45 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Thu, 6 Nov 2025 22:45:07 +0000 (22:45 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/daemon/graph.c
src/daemon/time.h

index 1c400ef6d31305016ebfb79947339311a057fc40..4042b96d95699e3cd6197d17a6e6195214844f68 100644 (file)
@@ -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);
index 2409c0bca40dc34e160af7e39d099a14d18146b8..61990236519e525f05c6b60b56b1bd8e2bd9e0dd 100644 (file)
@@ -24,7 +24,7 @@
 #include <time.h>
 
 // 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)