diff --git a/dlls/ntdll/debugtools.c b/dlls/ntdll/debugtools.c index cb08285..130e5d7 100644 --- a/dlls/ntdll/debugtools.c +++ b/dlls/ntdll/debugtools.c @@ -29,6 +29,7 @@ # include #endif #include +#include #include "wine/debug.h" #include "wine/exception.h" @@ -39,6 +40,7 @@ #include "ntdll_misc.h" WINE_DECLARE_DEBUG_CHANNEL(tid); +WINE_DECLARE_DEBUG_CHANNEL(timestamps); static struct __wine_debug_functions default_funcs; @@ -164,8 +166,16 @@ static int NTDLL_dbg_vlog( enum __wine_debug_class cls, struct __wine_debug_chan /* only print header if we are at the beginning of the line */ if (info->out_pos == info->output || info->out_pos[-1] == '\n') { + /* Prepend a timestamp to each line, if requested. */ + if (TRACE_ON(timestamps)) + { + struct timeval tv; + if (!gettimeofday(&tv, NULL)) + ret += wine_dbg_printf( "[%ld.%06ld] ", tv.tv_sec, tv.tv_usec); + } + if (TRACE_ON(tid)) - ret = wine_dbg_printf( "%04x:", GetCurrentThreadId() ); + ret += wine_dbg_printf( "%04x:", GetCurrentThreadId() ); if (cls < sizeof(classes)/sizeof(classes[0])) ret += wine_dbg_printf( "%s:%s:%s ", classes[cls], channel->name, function ); }