diff options
Diffstat (limited to 'print-arista.c')
-rw-r--r-- | print-arista.c | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/print-arista.c b/print-arista.c index 039a1ffd..079ad684 100644 --- a/print-arista.c +++ b/print-arista.c @@ -10,7 +10,6 @@ #include "netdissect.h" #include "extract.h" -#include "addrtoname.h" /* @@ -93,17 +92,13 @@ arista_print_date_hms_time(netdissect_options *ndo, uint32_t seconds, uint32_t nanoseconds) { time_t ts; - struct tm *tm; - char buf[BUFSIZE]; + char buf[sizeof("-yyyyyyyyyy-mm-dd hh:mm:ss")]; ts = seconds + (nanoseconds / 1000000000); nanoseconds %= 1000000000; - if (NULL == (tm = gmtime(&ts))) - ND_PRINT("gmtime() error"); - else if (0 == strftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S", tm)) - ND_PRINT("strftime() error"); - else - ND_PRINT("%s.%09u", buf, nanoseconds); + ND_PRINT("%s.%09u", + nd_format_time(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S", + gmtime(&ts)), nanoseconds); } int |