]> git.ipfire.org Git - fireperf.git/commitdiff
timespec_delta: Return seconds as double
authorMichael Tremer <michael.tremer@ipfire.org>
Tue, 23 Feb 2021 14:30:00 +0000 (14:30 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Tue, 23 Feb 2021 14:30:00 +0000 (14:30 +0000)
The stats printing function expected this in seconds

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/util.c
src/util.h

index 551574bc025ca7980e5d3019252f43294df57d40..558a478eb9c0eae27cc13160fe38779a1de5f7e0 100644 (file)
@@ -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))
                -
index 077134f40f43edeefbcf440d0a720c26612aa56d..8315b945d407d0801f2a3235050d994a32792eed 100644 (file)
@@ -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);