- struct tm *tm;
- char buf[BUFSIZE];
-
- if (cp + 4 != ep)
- goto corrupt;
- TCHECK2(*cp, 4);
- t = EXTRACT_32BITS(cp);
- if (NULL == (tm = gmtime(&t)))
- printf(": gmtime() error");
- else if (0 == strftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S", tm))
- printf(": strftime() error");
- else
- printf(": %s UTC", buf);
- return 0;
-
-corrupt:
- printf(": %s", corrupt_str);
- TCHECK2(*cp, ep - cp);
- return 0;
-trunc:
- printf(" %s", trunc_str);
- return -1;
+ char buf[sizeof("-yyyyyyyyyy-mm-dd hh:mm:ss UTC")];
+
+ if (len != 4)
+ goto invalid;
+ t = GET_BE_U_4(cp);
+ ND_PRINT(": %s",
+ nd_format_time(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S UTC",
+ gmtime(&t)));
+ return;
+
+invalid:
+ nd_print_invalid(ndo);
+ ND_TCHECK_LEN(cp, len);