summaryrefslogtreecommitdiff
path: root/common.h
diff options
context:
space:
mode:
Diffstat (limited to 'common.h')
-rw-r--r--common.h12
1 files changed, 9 insertions, 3 deletions
diff --git a/common.h b/common.h
index 45f99c4..cad48ce 100644
--- a/common.h
+++ b/common.h
@@ -17,10 +17,16 @@
#include "tools/socket.h"
#ifdef DEBUG
-# include <stdio.h>
-# define Dprintf(x...) fprintf(stderr, x)
+#include <stdio.h>
+#include <time.h>
+#define Dprintf(fmt, x...) {\
+ struct timespec ts;\
+ clock_gettime(CLOCK_MONOTONIC, &ts);\
+ fprintf(stderr, "%ld.%.3ld [%d] "fmt,\
+ ts.tv_sec, ts.tv_nsec / 1000000, cThread::ThreadId(), ##x);\
+}
#else
-# define Dprintf(x...)
+#define Dprintf(x...)
#endif
#if APIVERSNUM >= 10714