From 184196a6d6742ef868f5ca554c3e2555c01daadc Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Tue, 23 Feb 2021 14:30:00 +0000 Subject: [PATCH] timespec_delta: Return seconds as double The stats printing function expected this in seconds Signed-off-by: Michael Tremer --- src/util.c | 4 ++-- src/util.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/util.c b/src/util.c index 551574b..558a478 100644 --- a/src/util.c +++ b/src/util.c @@ -86,8 +86,8 @@ const char* format_timespec(const struct timespec* t) { return NULL; } -unsigned long timespec_delta(struct timespec* t1, struct timespec* t2) { - // Compute delta in milliseconds +double timespec_delta(struct timespec* t1, struct timespec* t2) { + // Compute delta in seconds return ( ((t1->tv_sec * 1000) + (t1->tv_nsec / 1000000)) - diff --git a/src/util.h b/src/util.h index 077134f..8315b94 100644 --- a/src/util.h +++ b/src/util.h @@ -28,4 +28,4 @@ enum { char* format_size(ssize_t size, int unit); const char* format_timespec(const struct timespec* t); -unsigned long timespec_delta(struct timespec* t1, struct timespec* t2); +double timespec_delta(struct timespec* t1, struct timespec* t2); -- 2.47.2