From a49a2ed073f478de76abf81b917d9b6f953c3f22 Mon Sep 17 00:00:00 2001 From: Bruno Raoult Date: Tue, 6 Dec 2022 15:17:04 +0100 Subject: [PATCH] debug.h: tentatively build on 32 bits arch --- 2020/libsrc/debug.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/2020/libsrc/debug.c b/2020/libsrc/debug.c index c1e5b9c..9c5f981 100644 --- a/2020/libsrc/debug.c +++ b/2020/libsrc/debug.c @@ -19,12 +19,13 @@ #define DEBUG_DEBUG #endif +#include "bits.h" #include "debug.h" #define NANOSEC 1000000000 /* nano sec in sec */ #define MILLISEC 1000000 /* milli sec in sec */ -static s64 timer_start; /* in nanosecond */ +static long long timer_start; /* in nanosecond */ static u32 debug_level=0; void debug_level_set(u32 level) @@ -48,7 +49,7 @@ void debug_init(u32 level) log(0, "timer started.\n"); } -inline static s64 timer_elapsed() +inline static long long timer_elapsed() { struct timespec timer; @@ -75,9 +76,9 @@ void debug(u32 level, bool timestamp, u32 indent, const char *src, printf("%*s", 2*(indent-1), ""); if (timestamp) { - s64 diff = timer_elapsed(); - printf("%ld.%03ld ", diff/NANOSEC, (diff/1000000)%1000); - printf("%010ld ", diff); + long long diff = timer_elapsed(); + printf("%lld.%03lld ", diff/NANOSEC, (diff/1000000)%1000); + printf("%010lld ", diff); } if (src) {