--- main/astfd.c (Asterisk 13.10.0) +++ main/astfd.c (working copy) @@ -47,4 +47,6 @@ #include "asterisk/strings.h" #include "asterisk/unaligned.h" +#include "asterisk/localtime.h" +#include "asterisk/time.h" static struct fdleaks { @@ -55,4 +57,5 @@ char function[25]; char callargs[60]; + struct timeval now; } fdleaks[1024] = { { "", }, }; @@ -80,4 +83,5 @@ do { \ struct fdleaks *tmp = &fdleaks[offset]; \ + tmp->now = ast_tvnow(); \ COPY(tmp->file, file); \ tmp->line = line; \ @@ -281,6 +285,11 @@ for (i = 0; i < ARRAY_LEN(fdleaks); i++) { if (fdleaks[i].isopen) { + struct ast_tm tm = {0}; + char datestring[256]; + + ast_localtime(&fdleaks[i].now, &tm, NULL); + ast_strftime(datestring, sizeof(datestring), "%F %T", &tm); snprintf(line, sizeof(line), "%d", fdleaks[i].line); - ast_cli(a->fd, "%5d %15s:%-7.7s (%-25s): %s(%s)\n", i, fdleaks[i].file, line, fdleaks[i].function, fdleaks[i].callname, fdleaks[i].callargs); + ast_cli(a->fd, "%5d [%s] %22s:%-7.7s (%-25s): %s(%s)\n", i, datestring, fdleaks[i].file, line, fdleaks[i].function, fdleaks[i].callname, fdleaks[i].callargs); } }