X-Git-Url: https://git.tcpdump.org/tcpdump/blobdiff_plain/424961546a4e32086ff7e431794173a2d0901469..HEAD:/print-ahcp.c diff --git a/print-ahcp.c b/print-ahcp.c index 9859f760..d2efc7f8 100644 --- a/print-ahcp.c +++ b/print-ahcp.c @@ -29,9 +29,7 @@ /* Based on draft-chroboczek-ahcp-00 and source code of ahcpd-0.53 */ -#ifdef HAVE_CONFIG_H #include -#endif #include "netdissect-stdinc.h" @@ -102,18 +100,14 @@ ahcp_time_print(netdissect_options *ndo, const u_char *cp, uint8_t len) { time_t t; - struct tm *tm; - char buf[BUFSIZE]; + char buf[sizeof("-yyyyyyyyyy-mm-dd hh:mm:ss UTC")]; if (len != 4) goto invalid; t = GET_BE_U_4(cp); - if (NULL == (tm = gmtime(&t))) - 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 UTC", buf); + ND_PRINT(": %s", + nd_format_time(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S UTC", + gmtime(&t))); return; invalid: