]> The Tcpdump Group git mirrors - tcpdump/blobdiff - smbutil.c
Makefile.in: don't remove configure and config.h.in in make distclean.
[tcpdump] / smbutil.c
index ff32ecce2ba43a5a12159ed3d27610654a006feb..f33a323fbf2c7c4037ec7ffd8a84c62c40e25aa3 100644 (file)
--- a/smbutil.c
+++ b/smbutil.c
@@ -768,8 +768,8 @@ smb_fdata1(netdissect_options *ndo,
        case 'T':
          {
            time_t t;
-           struct tm *lt;
            const char *tstring;
+           char buffer[sizeof("Www Mmm dd hh:mm:ss yyyyy")];
            uint32_t x;
 
            switch (atoi(fmt + 1)) {
@@ -799,14 +799,11 @@ smb_fdata1(netdissect_options *ndo,
                break;
            }
            if (t != 0) {
-               lt = localtime(&t);
-               if (lt != NULL)
-                   tstring = asctime(lt);
-               else
-                   tstring = "(Can't convert time)\n";
+                   tstring = nd_format_time(buffer, sizeof(buffer), "%a %b %e %T %Y",
+                   localtime(&t));
            } else
-               tstring = "NULL\n";
-           ND_PRINT("%s", tstring);
+               tstring = "NULL";
+           ND_PRINT("%s\n", tstring);
            fmt++;
            while (ND_ASCII_ISDIGIT(*fmt))
                fmt++;