debug.h: tentatively build on 32 bits arch

This commit is contained in:
2022-12-06 15:17:04 +01:00
parent 2c14abff21
commit a49a2ed073

View File

@@ -19,12 +19,13 @@
#define DEBUG_DEBUG #define DEBUG_DEBUG
#endif #endif
#include "bits.h"
#include "debug.h" #include "debug.h"
#define NANOSEC 1000000000 /* nano sec in sec */ #define NANOSEC 1000000000 /* nano sec in sec */
#define MILLISEC 1000000 /* milli 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; static u32 debug_level=0;
void debug_level_set(u32 level) void debug_level_set(u32 level)
@@ -48,7 +49,7 @@ void debug_init(u32 level)
log(0, "timer started.\n"); log(0, "timer started.\n");
} }
inline static s64 timer_elapsed() inline static long long timer_elapsed()
{ {
struct timespec timer; struct timespec timer;
@@ -75,9 +76,9 @@ void debug(u32 level, bool timestamp, u32 indent, const char *src,
printf("%*s", 2*(indent-1), ""); printf("%*s", 2*(indent-1), "");
if (timestamp) { if (timestamp) {
s64 diff = timer_elapsed(); long long diff = timer_elapsed();
printf("%ld.%03ld ", diff/NANOSEC, (diff/1000000)%1000); printf("%lld.%03lld ", diff/NANOSEC, (diff/1000000)%1000);
printf("%010ld ", diff); printf("%010lld ", diff);
} }
if (src) { if (src) {