From 34f4e138332b16fed2d4dfbbfd469a2e0983c95d Mon Sep 17 00:00:00 2001 From: Jim Hague Date: Fri, 6 Oct 2017 16:24:56 +0100 Subject: [PATCH] Have separate Windows DEBUG_NL() similar to DEBUG_ON(). This removes a build warning. --- src/debug.h | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/debug.h b/src/debug.h index 8f3c2c33..d048def5 100644 --- a/src/debug.h +++ b/src/debug.h @@ -59,6 +59,20 @@ fprintf(stderr, "[%s.%.6d] ", buf_dEbUgSyM, (int)tv_dEbUgSyM.tv_usec); \ fprintf(stderr, __VA_ARGS__); \ } while (0) + +#define DEBUG_NL(...) do { \ + struct timeval tv_dEbUgSyM; \ + struct tm tm_dEbUgSyM; \ + char buf_dEbUgSyM[10]; \ + time_t tsec_dEbUgSyM; \ + \ + gettimeofday(&tv_dEbUgSyM, NULL); \ + tsec_dEbUgSyM = (time_t) tv_dEbUgSyM.tv_sec; \ + gmtime_s(&tm_dEbUgSyM, (const time_t *) &tsec_dEbUgSyM); \ + strftime(buf_dEbUgSyM, 10, "%H:%M:%S", &tm_dEbUgSyM); \ + fprintf(stderr, "[%s.%.6d] ", buf_dEbUgSyM, (int)tv_dEbUgSyM.tv_usec); \ + fprintf(stderr, __VA_ARGS__); \ + } while (0) #else #define DEBUG_ON(...) do { \ struct timeval tv_dEbUgSyM; \ @@ -71,9 +85,8 @@ fprintf(stderr, "[%s.%.6d] ", buf_dEbUgSyM, (int)tv_dEbUgSyM.tv_usec); \ fprintf(stderr, __VA_ARGS__); \ } while (0) -#endif -#define DEBUG_NL(...) do { \ +#define DEBUG_NL(...) do { \ struct timeval tv_dEbUgSyM; \ struct tm tm_dEbUgSyM; \ char buf_dEbUgSyM[10]; \ @@ -85,7 +98,7 @@ fprintf(stderr, __VA_ARGS__); \ fprintf(stderr, "\n"); \ } while (0) - +#endif #define DEBUG_OFF(...) do {} while (0)