summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2014-07-29 15:06:17 +0000
committerMichael Adam <obnox@samba.org>2014-07-31 18:49:47 +0200
commit601b2b04530445344255992ebf6fb08a5ccf6eaa (patch)
tree42f8b7eace1ff5106a88cad3a15f481e94acffa0 /lib
parent15b0f57696cf8c1ae1c8760008b414f9a456bc49 (diff)
downloadsamba-601b2b04530445344255992ebf6fb08a5ccf6eaa.tar.gz
debug: Use timeval_str_buf in dbghdrclass
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/util/debug.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/lib/util/debug.c b/lib/util/debug.c
index 6dbf906177d..5d202ef8be3 100644
--- a/lib/util/debug.c
+++ b/lib/util/debug.c
@@ -971,6 +971,8 @@ bool dbghdrclass(int level, int cls, const char *location, const char *func)
int old_errno = errno;
bool verbose = false;
char header_str[200];
+ struct timeval tv;
+ struct timeval_buf tvbuf;
if( format_pos ) {
/* This is a fudge. If there is stuff sitting in the format_bufr, then
@@ -1028,21 +1030,18 @@ bool dbghdrclass(int level, int cls, const char *location, const char *func)
classname_table[cls]);
}
+ GetTimeOfDay(&tv);
+ timeval_str_buf(&tv, state.settings.debug_hires_timestamp, &tvbuf);
+
/* Print it all out at once to prevent split syslog output. */
if( state.settings.debug_prefix_timestamp ) {
- char *time_str = current_timestring(NULL,
- state.settings.debug_hires_timestamp);
- (void)Debug1( "[%s, %2d%s] ",
- time_str,
- level, header_str);
- talloc_free(time_str);
+ (void)Debug1("[%s, %2d%s] ",
+ tvbuf.buf,
+ level, header_str);
} else {
- char *time_str = current_timestring(NULL,
- state.settings.debug_hires_timestamp);
- (void)Debug1( "[%s, %2d%s] %s(%s)\n",
- time_str,
- level, header_str, location, func );
- talloc_free(time_str);
+ (void)Debug1("[%s, %2d%s] %s(%s)\n",
+ tvbuf.buf,
+ level, header_str, location, func );
}
errno = old_errno;